:root {
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --surface: #111;
    --surface-hover: #1a1a1a;
    --color-primary: #10b981;
    --color-primary-hover: #059669;
    --color-primary-dim: rgba(16, 185, 129, 0.1);
    --color-border: #222;
    --color-text: #fff;
    --color-text-muted: #a0a0a0;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(16, 185, 129, 0.1);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
    cursor: pointer;
}

*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    background: var(--bg-primary);
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

img, picture, video, canvas, svg { 
    display: block; 
    max-width: 100%; 
}

input, button, textarea, select { 
    font: inherit; 
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.script-card, .admin-item, .btn, .stat-card {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.navbar {
    will-change: backdrop-filter;
    transform: translateZ(0);
}

@media (prefers-reduced-motion: reduce) {
    .script-card, .admin-item, .btn, .animate__animated {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.navbar {
    position: fixed; 
    top: 0; 
    width: 100%; 
    height: 64px;
    background: rgba(5,5,5,0.85); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border); 
    z-index: 1000;
}

@supports not (backdrop-filter: blur(16px)) {
    .navbar {
        background: rgba(5,5,5,0.95);
    }
}

.nav-content {
    max-width: 1400px; 
    margin: 0 auto; 
    height: 100%; 
    padding: 0 32px;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
}

.nav-left { 
    flex: 0 0 auto; 
}

.brand { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    cursor: pointer;
    transition: 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.brand:hover {
    opacity: 0.8;
}

.nav-icon { 
    width: 32px; 
    height: 32px; 
    border-radius: 50%;
    object-fit: cover;
}

.nav-title { 
    font-weight: 700; 
    font-size: 18px; 
    letter-spacing: -0.5px; 
    display: block !important; 
    visibility: visible !important;
    opacity: 1 !important;
}

.nav-center { 
    flex: 1; 
    display: flex; 
    justify-content: center; 
    padding: 0 32px; 
}

.search-wrapper { 
    position: relative; 
    width: 100%; 
    max-width: 480px; 
}

.search-icon { 
    position: absolute; 
    left: 14px; 
    top: 50%; 
    transform: translateY(-50%); 
    color: var(--color-text-muted);
    pointer-events: none;
}

#search {
    width: 100%; 
    background: var(--surface); 
    border: 1px solid var(--color-border);
    color: var(--color-text); 
    padding: 10px 16px 10px 42px; 
    border-radius: 99px;
    font-size: 14px; 
    transition: 0.2s;
}

#search:focus { 
    border-color: var(--color-primary); 
    background: var(--bg-secondary); 
}

.nav-right { 
    flex: 0 0 auto; 
    display: flex; 
    gap: 12px; 
    align-items: center; 
}

.container {
    max-width: 1400px; 
    margin: 80px auto 40px; 
    padding: 0 32px;
    min-height: calc(100vh - 120px);
}

.content-wrapper { 
    display: grid; 
    grid-template-columns: 240px 1fr; 
    gap: 40px; 
}

.sidebar { 
    position: sticky; 
    top: 100px; 
    height: fit-content; 
}

.sidebar-section { 
    margin-bottom: 24px; 
}

.sidebar-title { 
    font-size: 11px; 
    font-weight: 700; 
    color: var(--color-text-muted); 
    text-transform: uppercase; 
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px; 
    color: var(--color-text-muted); 
    text-decoration: none;
    font-size: 14px; 
    font-weight: 600; 
    border-radius: 8px; 
    margin-bottom: 4px; 
    transition: 0.2s;
}

.sidebar-link svg {
    opacity: 0.6;
}

.sidebar-link:hover { 
    color: var(--color-text); 
    background: var(--surface); 
}

.sidebar-link.active { 
    color: var(--color-primary); 
    background: var(--color-primary-dim); 
}

.sidebar-link.active svg {
    opacity: 1;
}

.select-sm {
    padding: 8px 12px;
    font-size: 13px;
    height: 36px;
}

.script-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 16px; 
}

.script-card {
    background: var(--surface); 
    border: 1px solid var(--color-border); 
    border-radius: 12px;
    padding: 24px; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    display: flex; 
    flex-direction: column;
}

.script-card:hover { 
    transform: translateY(-2px); 
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.card-header-section { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 8px;
    gap: 12px;
}

.script-title { 
    font-size: 16px; 
    font-weight: 700; 
    color: #fff; 
    word-break: break-word;
    line-height: 1.4;
}

.card-meta { 
    margin-top: auto; 
    padding-top: 12px;
    font-size: 12px; 
    color: var(--color-text-muted); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.badge { 
    font-size: 10px; 
    font-weight: 800; 
    padding: 4px 8px; 
    border-radius: 6px; 
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-sm { 
    font-size: 9px; 
    padding: 3px 6px; 
}

.badge-public { 
    background: var(--color-primary); 
    color: #000; 
}

.badge-private { 
    background: var(--surface-hover); 
    color: var(--color-text-muted); 
    border: 1px solid var(--color-border); 
}

.badge-unlisted { 
    background: #f59e0b; 
    color: #000; 
}

.script-header-lg { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 24px; 
    flex-wrap: wrap; 
    gap: 16px; 
}

.script-header-lg h1 { 
    font-size: 32px; 
    letter-spacing: -1px; 
    line-height: 1.2; 
    margin-bottom: 12px;
    font-weight: 800;
}

.meta-row { 
    display: flex; 
    gap: 12px; 
    flex-wrap: wrap; 
}

.meta-badge {
    font-size: 13px; 
    color: var(--color-text-muted); 
    background: var(--surface);
    padding: 6px 12px; 
    border-radius: 6px; 
    border: 1px solid var(--color-border);
    display: inline-flex; 
    align-items: center; 
    gap: 6px;
}

.script-description { 
    color: var(--color-text-muted); 
    margin-bottom: 32px; 
    font-size: 15px; 
    max-width: 800px; 
    line-height: 1.7; 
}

.code-box { 
    background: var(--surface); 
    border: 1px solid var(--color-border); 
    border-radius: 12px; 
    overflow: hidden; 
}

.toolbar {
    background: var(--bg-secondary); 
    border-bottom: 1px solid var(--color-border);
    padding: 14px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 12px;
}

.toolbar-right { 
    display: flex; 
    gap: 8px; 
}

.file-info { 
    font-size: 13px; 
    color: var(--color-text-muted); 
    font-family: 'Courier New', monospace; 
}

pre { 
    margin: 0; 
    padding: 24px; 
    overflow-x: auto; 
    background: #0d0d0d !important; 
}

code { 
    font-family: 'Courier New', monospace; 
    font-size: 13px; 
    text-shadow: none !important;
    line-height: 1.6;
    tab-size: 2;
    -moz-tab-size: 2;
    -o-tab-size: 2;
}

.admin-panel { 
    max-width: 900px; 
    margin: 0 auto; 
}

.admin-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: 0.2s;
}

.btn-back:hover {
    color: var(--color-text);
    background: var(--surface);
}

.btn-back:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.admin-header-flex { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px; 
    border-bottom: 1px solid var(--color-border); 
    padding-bottom: 20px; 
    flex-wrap: wrap; 
    gap: 16px; 
}

.admin-header-flex h2 {
    font-size: 24px;
    font-weight: 800;
}

.tab-switcher { 
    background: var(--bg-secondary); 
    padding: 4px; 
    border-radius: 8px; 
    border: 1px solid var(--color-border); 
    display: flex; 
    gap: 4px; 
}

.tab-btn { 
    background: transparent; 
    border: none; 
    color: var(--color-text-muted); 
    padding: 8px 14px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 13px; 
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover { 
    color: #fff; 
}

.tab-btn.active { 
    background: var(--surface); 
    color: #fff; 
    box-shadow: var(--shadow-sm); 
}

.tab-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.modal-overlay { 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.8); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 2000; 
    backdrop-filter: blur(5px); 
    padding: 20px;
    overflow-y: auto;
}

.modal { 
    background: var(--surface); 
    border: 1px solid var(--color-border); 
    border-radius: 16px; 
    width: 100%; 
    max-width: 400px; 
    padding: 28px; 
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
}

.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 24px; 
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}

.close-btn { 
    background: none; 
    border: none; 
    color: var(--color-text-muted); 
    font-size: 28px; 
    cursor: pointer; 
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    line-height: 1; 
    transition: 0.2s; 
}

.close-btn:hover { 
    color: #fff;
    background: var(--surface-hover);
}

.close-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.editor-container {
    background: var(--surface);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.bot-form-container {
    background: var(--surface);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    margin-top: 24px;
}

.editor-container h3 {
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 700;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
}

.form-group-flex {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field { 
    width: 100%; 
    padding: 12px 14px; 
    background: var(--bg-secondary); 
    border: 1px solid var(--color-border); 
    color: #fff; 
    border-radius: 8px; 
    font-family: inherit; 
    font-size: 14px; 
    transition: 0.2s; 
}

.input-field:focus { 
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-dim);
}

.input-field::placeholder {
    color: var(--color-text-muted);
    opacity: 0.5;
}

textarea.input-field { 
    resize: vertical; 
    min-height: 150px;
}

.code-textarea {
    min-height: 400px;
    font-family: 'Courier New', monospace;
    background: #080808;
    line-height: 1.6;
    transition: border-color 0.2s;
    tab-size: 2;
    -moz-tab-size: 2;
    -o-tab-size: 2;
}

.code-textarea:hover {
    border-color: var(--color-border);
}

.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.bot-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    background: var(--color-primary); 
    color: #000; 
    border: none; 
    padding: 10px 18px;
    border-radius: 6px; 
    font-weight: 700; 
    cursor: pointer; 
    display: inline-flex;
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    font-size: 13px; 
    transition: 0.2s; 
    text-decoration: none;
}

.btn:hover { 
    background: var(--color-primary-hover);
    transform: scale(1.02); 
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-secondary { 
    background: transparent; 
    border: 1px solid var(--color-border); 
    color: #fff; 
}

.btn-secondary:hover { 
    border-color: var(--color-text-muted); 
    background: var(--surface); 
}

.btn-delete { 
    background: var(--color-danger) !important; 
    color: white !important; 
    border: 1px solid var(--color-danger) !important; 
}

.btn-delete:hover { 
    background: var(--color-danger-hover) !important; 
    border-color: var(--color-danger-hover) !important; 
}

.btn-sm { 
    padding: 7px 14px; 
    font-size: 12px; 
}

.btn-full { 
    width: 100%; 
    margin-top: 10px; 
}

.btn:active { 
    transform: scale(0.98); 
}

.btn-icon-only { 
    padding: 8px; 
}

.admin-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-list-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.admin-list-header span {
    color: var(--color-text-muted);
    font-size: 14px;
}

.admin-item {
    position: relative;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.admin-item:hover { 
    border-color: var(--color-border); 
    background: var(--surface);
    transform: translateX(4px);
}

.admin-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.admin-item-left { 
    flex: 1; 
}

.admin-item-left strong {
    font-size: 15px;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.admin-item-right {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
}

.admin-meta { 
    display: flex; 
    align-items: center; 
    gap: 10px;
    font-size: 13px;
}

.text-muted { 
    color: var(--color-text-muted); 
}

.empty-admin-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.bot-status {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-scheduled {
    background: #f59e0b;
    color: #000;
}

.status-sent {
    background: var(--color-primary);
    color: #000;
}

.status-pending {
    background: #6b7280;
    color: #fff;
}

.status-failed {
    background: var(--color-danger);
    color: #fff;
}

.status-cancelled {
    background: #ef4444;
    color: #fff;
}

.schedule-fields {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.schedule-fields.show {
    display: block;
}

.timezone-select {
    margin-top: 12px;
}

.bot-log {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #080808;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    border: 1px solid var(--color-border);
    max-height: 200px;
    overflow-y: auto;
}

.swipe-hint {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-danger);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.admin-item.swiping .swipe-hint {
    opacity: 0.7;
}

.admin-item.swipe-delete {
    transform: translateX(300px);
    opacity: 0;
}

@keyframes swipeDelete {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateX(100px);
        opacity: 0.7;
    }
    100% {
        transform: translateX(300px);
        opacity: 0;
    }
}

.swipe-delete-animation {
    animation: swipeDelete 0.5s ease forwards;
}

.spinner { 
    width: 32px; 
    height: 32px; 
    border: 3px solid var(--color-border); 
    border-top-color: var(--color-primary); 
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
    margin: 0 auto 16px; 
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

.loading { 
    color: var(--color-primary); 
    font-weight: 600; 
}

.empty-state { 
    text-align: center; 
    padding: 80px 20px; 
    grid-column: 1/-1; 
}

.empty-state h2 { 
    color: var(--color-text-muted); 
    font-size: 18px; 
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--color-text-muted);
    font-size: 14px;
    opacity: 0.7;
}

.btn-view-script {
    margin-left: auto;
}

.monaco-editor {
    border-radius: 8px;
}

.ql-toolbar.ql-snow {
    border: 1px solid var(--color-border) !important;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    background: var(--bg-secondary);
}

.ql-container.ql-snow {
    border: 1px solid var(--color-border) !important;
    border-top: none !important;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    background: var(--bg-secondary);
}

.ql-editor {
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
    min-height: 80px;
}

.ql-snow .ql-stroke {
    stroke: var(--color-text-muted) !important;
}

.ql-snow .ql-fill {
    fill: var(--color-text-muted) !important;
}

.ql-snow .ql-picker {
    color: var(--color-text-muted) !important;
}

.ql-snow .ql-picker-options {
    background: var(--surface) !important;
    border: 1px solid var(--color-border) !important;
}

.swal2-popup {
    background: var(--surface) !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border) !important;
}

.swal2-title {
    color: var(--color-text) !important;
}

.swal2-html-container {
    color: var(--color-text-muted) !important;
}

.swal2-confirm {
    background: var(--color-primary) !important;
}

.swal2-cancel {
    background: transparent !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text) !important;
}

#nprogress .bar {
    background: var(--color-primary) !important;
    height: 3px !important;
}

#nprogress .peg {
    box-shadow: 0 0 10px var(--color-primary), 0 0 5px var(--color-primary) !important;
}

#nprogress .spinner-icon {
    border-top-color: var(--color-primary) !important;
    border-left-color: var(--color-primary) !important;
}

.Toastify__toast {
    background: #333 !important;
}

@media print {
    .navbar, .admin-top-controls, .toolbar-right,
    .btn, button, .search-wrapper, .nav-right {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .code-box {
        break-inside: avoid;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    
    pre {
        background: white !important;
        color: black !important;
    }
}

@media (max-width: 768px) {
    .content-wrapper { 
        grid-template-columns: 1fr; 
        gap: 24px; 
    }
    
    .sidebar { 
        display: none; 
    }
    
    .nav-content { 
        padding: 0 16px; 
        flex-wrap: nowrap; 
    }
    
    .nav-title { 
        display: block !important; 
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 16px;
    }
    
    .nav-center { 
        display: flex; 
        padding: 0 12px;
        flex: 1;
        max-width: none;
    }
    
    .search-wrapper { 
        width: 100%;
        max-width: none;
    }
    
    #search {
        padding: 8px 12px 8px 36px;
        font-size: 13px;
        height: 36px;
    }
    
    .search-icon {
        left: 12px;
        width: 14px;
        height: 14px;
    }
    
    .nav-right { 
        gap: 8px; 
    }
    
    .nav-icon { 
        width: 28px; 
        height: 28px; 
    }
    
    .container { 
        margin-top: 70px; 
        padding: 0 16px; 
    }
    
    .toolbar { 
        flex-direction: column; 
        align-items: stretch; 
    }
    
    .toolbar-right { 
        justify-content: space-between; 
        margin-top: 10px; 
    }
    
    .toolbar-right .btn { 
        flex: 1; 
    }
    
    .script-grid { 
        grid-template-columns: 1fr; 
    }

    .script-header-lg h1 {
        font-size: 24px;
    }
    
    .admin-top-controls {
        padding: 0 0 16px 0;
        margin-bottom: 24px;
    }
    
    .admin-header-flex { 
        flex-direction: column; 
        align-items: stretch; 
    }
    
    .tab-switcher { 
        width: 100%; 
    }
    
    .tab-btn { 
        flex: 1;
        justify-content: center;
    }
    
    .editor-container, .bot-form-container {
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .editor-actions, .bot-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons .btn {
        width: 100%;
    }

    .modal {
        max-width: 90%;
        padding: 20px;
        margin: 10px;
    }

    .btn, .sidebar-link, .tab-btn {
        min-height: 44px;
    }
    
    .code-textarea {
        font-size: 16px;
    }
    
    .btn-view-script {
        margin-left: 0;
        width: 100%;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .modal-text {
        font-size: 14px;
    }

    .modal-text strong {
        font-size: 15px;
    }
    
    #editor-container {
        height: 400px !important;
    }
    
    .ql-toolbar.ql-snow {
        padding: 8px !important;
    }
    
    .ql-toolbar.ql-snow .ql-formats {
        margin-right: 8px !important;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .navbar { 
        position: absolute; 
        height: 56px;
    }
    
    .container { 
        margin-top: 60px; 
    }

    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal {
        max-height: 80vh;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .modal-body {
        gap: 15px;
    }

    .modal-text {
        font-size: 14px;
        line-height: 1.4;
    }

    .modal-text strong {
        margin: 8px 0;
        font-size: 15px;
    }

    .modal-actions {
        gap: 8px;
    }

    .modal-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    #editor-container {
        height: 300px !important;
    }
    
    .editor-container {
        padding: 16px !important;
    }
}

@media (orientation: portrait) and (max-height: 700px) {
    .modal {
        max-height: 85vh;
        padding: 20px;
    }

    .modal-body {
        gap: 15px;
    }

    .modal-text {
        font-size: 14px;
    }

    .modal-actions .btn {
        padding: 10px 14px;
    }
    
    #editor-container {
        height: 350px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .content-wrapper { 
        grid-template-columns: 200px 1fr; 
        gap: 24px; 
    }
    
    .search-wrapper { 
        max-width: 360px; 
    }
    
    .container {
        padding: 0 24px;
    }
    
    .nav-content {
        padding: 0 24px;
    }

    .modal {
        max-width: 350px;
    }
    
    #editor-container {
        height: 450px !important;
    }
}

@media (min-width: 1025px) {
    .modal-overlay {
        padding: 40px;
    }

    .modal {
        max-width: 400px;
        padding: 32px;
    }

    .modal-actions .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}
