:root {
    --bg-color: #f0f4f8;
    --text-color: #183550;
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --accent: #ff9919;
    --danger: #ff4757;
    --success: #2ed573;
}

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

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(24, 53, 80, 0.2);
    border-radius: 10px;
    transition: 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(24, 53, 80, 0.4);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 15px 30px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.05);
}

.header h1 { font-size: 1.5em; font-weight: 800; }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.btn-primary { background: var(--text-color); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(24,53,80,0.3); }



.btn-undo { background: var(--accent); color: white; }
.btn-undo:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255,153,25,0.4); }

.btn-success { background: var(--success); color: white; font-size: 1.1em; padding: 12px 30px;}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(46,213,115,0.4); }
.btn-danger { 
    background: var(--danger); 
    color: white; 
    padding: 5px 10px; 
    font-size: 1em; 
    font-weight: 800;
}

.home-icon {
    text-decoration: none; 
    font-size: 1.4em; 
    filter: grayscale(1); 
    opacity: 0.7; 
    transition: all 0.3s ease;
}
.home-icon:hover {
    opacity: 1;
    filter: none;
    transform: scale(1.2);
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 25px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.tab-btn.active {
    background: var(--text-color);
    color: white;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.data-table th {
    text-align: left;
    padding: 10px 15px;
    color: rgba(24, 53, 80, 0.7);
    font-weight: 600;
    position: sticky;
    top: 0;
    background: #e0eafc; /* Match body start color */
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Subtle shadow when scrolling */
    white-space: nowrap;
}

.data-table th.sortable {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.2s;
}

.data-table th.sortable:hover {
    color: var(--text-color);
    background: #d0def3;
}

.sort-icon {
    display: inline-block;
    font-size: 0.8em;
    margin-left: 5px;
    opacity: 0.5;
    width: 12px;
    vertical-align: middle;
}

.data-table td {
    background: var(--glass-bg);
    padding: 12px 10px;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

.data-table td:first-child { border-left: 1px solid var(--glass-border); border-radius: 12px 0 0 12px; }
.data-table td:last-child { border-right: 1px solid var(--glass-border); border-radius: 0 12px 12px 0; }

.input-field {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    font-family: inherit;
    background: rgba(255,255,255,0.8);
}

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

.actions { white-space: nowrap; }

#toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    color: var(--text-color);
    padding: 15px 25px;
    border-radius: 15px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid var(--glass-border);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.error { border-left: 5px solid var(--danger); }
#toast.success { border-left: 5px solid var(--success); }

/* Utility Classes for Refactoring Inline Styles */
.flex-center-gap-20 { display: flex; align-items: center; gap: 20px; }
.flex-gap-10 { display: flex; gap: 10px; }
.flex-gap-4 { display: flex; gap: 4px; }
.flex-between-center-mb15 { margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.mb-15 { margin-bottom: 15px; }
.w-300 { width: 300px; }
.w-60 { width: 80px; }
.w-150 { width: 150px; max-width: 150px; }
.w-180 { width: 180px; max-width: 180px; }
.w-80 { width: 100px; }
.overflow-x-auto { 
    overflow-x: auto; 
    overflow-y: auto; 
    max-height: calc(100vh - 220px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
}
.d-none { display: none; }
.p-5-10-no-shrink { padding: 5px 10px; flex-shrink: 0; }
.info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: var(--text-color);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 5px;
    vertical-align: middle;
    opacity: 0.6;
    transition: opacity 0.3s;
}
.info-icon:hover { opacity: 1; }


/* Login Screen */
#login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 40px);
}

.login-card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 25px;
    font-weight: 800;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 15px;
    border-radius: 10px;
    font-size: 0.9em;
    border: 1px solid var(--glass-border);
}

.user-email {
    font-weight: 600;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#admin-content {
    display: none;
}

#admin-content.visible {
    display: block;
}
.login-form .input-field.invalid {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.05);
}

.login-error-msg {
    color: #ff4444;
    font-size: 0.85rem;
    margin-top: 10px;
    text-align: center;
    min-height: 20px;
}

.btn-success.saving {
    background: var(--accent) !important;
    opacity: 0.8;
    cursor: wait;
}

.btn-success.saved {
    background: var(--success) !important;
    filter: brightness(0.8);
}

/* ── Multi-Select Dropdown ────────────────────────────────── */
.ms-wrap {
    position: relative;
    min-width: 140px;
    max-width: 100%;
}

.ms-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82em;
    min-height: 36px;
    transition: border-color 0.2s;
    -webkit-user-select: none;
    user-select: none;
    font-family: inherit;
    color: var(--text-color);
    width: 100%;
}
.ms-btn:hover { border-color: rgba(24,53,80,0.35); }
.ms-wrap.open .ms-btn { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,153,25,0.15); }

.ms-disp {
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    text-align: left;
}

.ms-arr {
    opacity: 0.45;
    font-size: 0.75em;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.ms-wrap.open .ms-arr { transform: rotate(180deg); opacity: 0.8; }

.ms-drop {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 185px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.13);
    z-index: 200;
    padding: 5px 0;
    max-height: 230px;
    overflow-y: auto;
}
.ms-wrap.open .ms-drop { display: block; }

.ms-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.84em;
    transition: background 0.15s;
    color: var(--text-color);
    white-space: nowrap;
}
.ms-opt:hover { background: #f0f5fc; }
.ms-opt input[type=checkbox] {
    cursor: pointer;
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.ms-empty { color: rgba(24,53,80,0.38); font-style: italic; }
/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.progress-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
}
.progress-bar {
    width: 100%;
    height: 12px;
    background: #e0eafc;
    border-radius: 6px;
    overflow: hidden;
    margin: 15px 0;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.3s;
}
.translation-log {
    margin-top: 15px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    height: 200px;
    overflow-y: auto;
    font-size: 0.85em;
    text-align: left;
    white-space: pre-wrap;
    color: #333;
    font-family: monospace;
}
