/* ==========================
   PURITY UI DASHBOARD - VARIABLES
   ========================== */

:root {
    --teal-500: #4FD1C5;
    --teal-600: #38B2AC;
    --teal-700: #319795;
    --navy-900: #1A202C;
    --navy-800: #2D3748;
    --navy-700: #4A5568;
    --gray-50: #F7FAFC;
    --gray-100: #EDF2F7;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E0;
    --gray-600: #718096;
    --gray-700: #4A5568;
    --green-400: #48BB78;
    --green-500: #38A169;
    --blue-400: #4299E1;
    --orange-400: #ED8936;
    --red-400: #FC8181;
    --sidebar-width: 260px;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--navy-800);
    line-height: 1.6;
}

/* ==========================
   SIDEBAR
   ========================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: white;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 20px;
}

.sidebar-logo .logo-svg {
    flex: 1;
    min-width: 0;
}

.sidebar-logo .logo-svg svg {
    width: 100%;
    height: auto;
    max-height: 60px;
}

.sidebar-logo .sidebar-chart-icon .bar1 {
    animation: sidebarBarGrow 1s ease-out 0.1s both;
}

.sidebar-logo .sidebar-chart-icon .bar2 {
    animation: sidebarBarGrow 1s ease-out 0.2s both;
}

.sidebar-logo .sidebar-chart-icon .bar3 {
    animation: sidebarBarGrow 1s ease-out 0.3s both;
}

.sidebar-logo .sidebar-chart-icon .bar4 {
    animation: sidebarBarGrow 1s ease-out 0.4s both;
}

.sidebar-logo .sidebar-chart-icon .trend-line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: sidebarDrawLine 1.2s ease-out 0.6s both;
}

.sidebar-logo .sidebar-chart-icon .trend-dot,
.sidebar-logo .sidebar-chart-icon .arrow-line,
.sidebar-logo .sidebar-chart-icon .arrow-head {
    opacity: 0;
    animation: sidebarFadeIn 0.4s ease-out 0.9s both;
}

.sidebar-logo .mmas-text {
    opacity: 0;
    animation: sidebarSlideIn 0.6s ease-out 1.1s both;
}

@keyframes sidebarBarGrow {
    from {
        stroke-dasharray: 0 20;
    }
    to {
        stroke-dasharray: 20 0;
    }
}

@keyframes sidebarDrawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes sidebarFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes sidebarSlideIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-logo .moscow-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    height: 60px;
    justify-content: center;
}

.sidebar-logo .time-display {
    font-family: 'Roboto', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--teal-600);
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(79, 209, 197, 0.3);
    line-height: 1;
}

.sidebar-logo .time-label {
    font-family: 'Roboto', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    letter-spacing: 0.5px;
    line-height: 1;
}

.sidebar-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 16px 20px;
}

.sidebar-nav {
    padding: 0 12px 24px 12px;
}

.sidebar-section-title {
    padding: 16px 12px 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-600);
    letter-spacing: 0.5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--navy-800);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: var(--gray-100);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 209, 197, 0.3);
}

.sidebar-link.active i {
    color: white;
}

.sidebar-link-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================
   MAIN WRAPPER
   ========================== */

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================
   TOPBAR
   ========================== */

.topbar {
    background: white;
    height: 72px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.topbar-title i {
    color: var(--teal-500);
    font-size: 1.3rem;
}

.topbar-search {
    position: relative;
    max-width: 400px;
    flex: 1;
}

.topbar-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
    font-size: 0.9rem;
}

.topbar-search input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: var(--gray-50);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--teal-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--gray-700);
    transition: all 0.2s;
    text-decoration: none;
}

.topbar-icon:hover {
    background: var(--gray-100);
    color: var(--teal-600);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--gray-100);
    border-radius: 10px;
    color: var(--navy-800);
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.topbar-user:hover {
    background: var(--gray-200);
}

.topbar-user i {
    color: var(--teal-500);
    font-size: 1.3rem;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 220px;
    display: none;
    z-index: 100;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.user-dropdown-header p {
    margin: 0;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.user-dropdown-header strong {
    color: var(--gray-900);
    font-size: 1rem;
}

.user-dropdown-section {
    padding: 4px 0;
}

.user-dropdown-section-title {
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s;
}

.user-dropdown-link:hover {
    background: var(--teal-50);
    color: var(--teal-600);
}

.user-dropdown-link i {
    width: 20px;
    text-align: center;
    color: var(--gray-500);
}

.user-dropdown-link:hover i {
    color: var(--teal-600);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

/* ==========================
   MAIN CONTENT
   ========================== */

.main-content {
    flex: 1;
    padding: 30px;
}

/* ==========================
   DASHBOARD CARDS
   ========================== */

.dashboard-header {
    margin-bottom: 24px;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy-900);
    margin-bottom: 8px;
}

.dashboard-subtitle {
    color: var(--gray-600);
    font-size: 0.95rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-600);
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.stat-icon.teal {
    background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
}

.stat-icon.green {
    background: linear-gradient(135deg, var(--green-400), var(--green-500));
}

.stat-icon.blue {
    background: linear-gradient(135deg, var(--blue-400), #3182CE);
}

.stat-icon.orange {
    background: linear-gradient(135deg, var(--orange-400), #DD6B20);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy-900);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 0.85rem;
    color: var(--green-500);
    font-weight: 600;
}

.stat-change i {
    margin-right: 4px;
}

/* ==========================
   INFO CARDS
   ========================== */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.info-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-900);
    margin-bottom: 16px;
}

.info-card p {
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.info-card .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.info-card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 209, 197, 0.3);
}

/* ==========================
   FORMS
   ========================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--navy-800);
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: 'Roboto', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 209, 197, 0.3);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--navy-800);
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* ==========================
   ALERTS
   ========================== */

.flash-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background: #C6F6D5;
    border-left: 4px solid var(--green-500);
    color: #22543D;
}

.alert-error {
    background: #FED7D7;
    border-left: 4px solid var(--red-400);
    color: #742A2A;
}

.alert-warning {
    background: #FEEBC8;
    border-left: 4px solid var(--orange-400);
    color: #7C2D12;
}

.alert-info {
    background: #BEE3F8;
    border-left: 4px solid var(--blue-400);
    color: #2C5282;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* ==========================
   FOOTER
   ========================== */

.footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 20px 30px;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.footer strong {
    color: var(--teal-600);
    font-weight: 600;
}

/* ==========================
   LOGIN PAGE
   ========================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 180px;
    max-width: 100%;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo svg {
    width: 100%;
    height: auto;
}

.login-logo .bar1 {
    animation: barGrow 1.5s ease-out 0.1s both;
}

.login-logo .bar2 {
    animation: barGrow 1.5s ease-out 0.2s both;
}

.login-logo .bar3 {
    animation: barGrow 1.5s ease-out 0.3s both;
}

.login-logo .bar4 {
    animation: barGrow 1.5s ease-out 0.4s both;
}

.login-logo .trend-line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLine 2s ease-out 0.8s both;
}

.login-logo .trend-dot {
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.2s both;
}

.login-logo .arrow-line,
.login-logo .arrow-head {
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.4s both;
}

.login-logo .mmas-text {
    opacity: 0;
    animation: slideIn 0.8s ease-out 1.6s both;
}

@keyframes barGrow {
    from {
        stroke-dasharray: 0 20;
    }
    to {
        stroke-dasharray: 20 0;
    }
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy-900);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--gray-600);
    font-weight: 400;
}

.login-form {
    margin-bottom: 25px;
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--navy-800);
    font-size: 0.9rem;
}

.form-field label i {
    color: var(--teal-500);
    margin-right: 6px;
}

.form-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

.form-field input:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.form-field input::placeholder {
    color: var(--gray-300);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(79, 209, 197, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 209, 197, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.access-request-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--teal-600);
    border: 2px solid var(--teal-500);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.access-request-btn:hover {
    background: var(--teal-50);
    border-color: var(--teal-600);
}

.login-warning {
    background: #FED7D7;
    border-left: 4px solid var(--red-400);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
    color: #742A2A;
    margin-top: 20px;
}

.login-warning i {
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 20px;
    border-bottom: 2px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--navy-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--teal-500);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.access-form {
    padding: 24px;
}

.access-form .form-field {
    margin-bottom: 20px;
}

.access-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Roboto', sans-serif;
    resize: vertical;
    transition: all 0.3s ease;
}

.access-form textarea:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
    color: white;
    box-shadow: 0 4px 12px rgba(79, 209, 197, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 209, 197, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* ==========================
   RESPONSIVE
   ========================== */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .main-content {
        padding: 20px 16px;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-logo {
        width: 150px;
    }
}

/* ==========================
   PURITY UI - FEATURE PAGES
   ========================== */

.feature-page {
    min-height: calc(100vh - 80px);
}

.page-hero {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 60%, var(--teal-700) 100%);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 10px 30px rgba(79, 209, 197, 0.25);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.page-hero-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 8px;
}

.page-hero-subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
}

.page-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================
   CARDS
   ========================== */

.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--navy-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--teal-500);
    font-size: 1.1rem;
}

.card-subtitle {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--navy-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle i {
    color: var(--teal-500);
    font-size: 0.95rem;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.table-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.table-toolbar {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.table-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.table-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
    font-size: 0.9rem;
}

.table-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.table-search input:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.form-card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ==========================
   FORMS
   ========================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid.single-col {
    grid-template-columns: 1fr;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy-800);
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-label i {
    color: var(--teal-500);
    font-size: 0.85rem;
}

.input-label .required {
    color: var(--red-400);
    margin-left: 2px;
}

.form-control {
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.select-control {
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-control:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.file-upload {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gray-50);
}

.file-upload:hover {
    border-color: var(--teal-500);
    background: rgba(79, 209, 197, 0.05);
}

.file-upload i {
    font-size: 2.5rem;
    color: var(--teal-500);
    margin-bottom: 12px;
    display: block;
}

.file-upload-text {
    font-size: 0.95rem;
    color: var(--navy-800);
    font-weight: 500;
    margin-bottom: 6px;
}

.file-upload-hint {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.file-upload input[type="file"] {
    display: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: .3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    gap: 12px;
}

.checkbox-control {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-control:checked {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    border-color: var(--teal-500);
}

.checkbox-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--navy-800);
}

.checkbox-text i {
    color: var(--teal-500);
    font-size: 0.9rem;
}

/* ==========================
   TABLES
   ========================== */

.purity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.purity-table thead {
    background: var(--gray-50);
}

.purity-table thead th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--navy-800);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.purity-table tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.2s ease;
}

.purity-table tbody tr:hover {
    background: var(--gray-50);
}

.purity-table tbody td {
    padding: 16px 20px;
    color: var(--navy-700);
}

.purity-table tbody tr:last-child {
    border-bottom: none;
}

.table-pagination {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--navy-800);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--teal-500);
    color: var(--teal-500);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    color: white;
    border-color: transparent;
}

/* ==========================
   BADGES
   ========================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge i {
    margin-right: 4px;
    font-size: 0.75rem;
}

.badge-success {
    background: rgba(72, 187, 120, 0.15);
    color: var(--green-500);
}

.badge-warning {
    background: rgba(237, 137, 54, 0.15);
    color: var(--orange-400);
}

.badge-danger {
    background: rgba(252, 129, 129, 0.15);
    color: var(--red-400);
}

.badge-info {
    background: rgba(66, 153, 225, 0.15);
    color: var(--blue-400);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ==========================
   BUTTONS EXTENDED
   ========================== */

.btn-outline {
    background: white;
    border: 2px solid var(--teal-500);
    color: var(--teal-500);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline:hover {
    background: var(--teal-500);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 209, 197, 0.3);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--teal-500);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-ghost:hover {
    background: rgba(79, 209, 197, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red-400) 0%, #E53E3E 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(252, 129, 129, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(252, 129, 129, 0.4);
}

/* ==========================
   UTILITY CLASSES
   ========================== */

.gap-sm { gap: 12px; }
.gap-md { gap: 20px; }
.gap-lg { gap: 32px; }

.py-sm { padding-top: 12px; padding-bottom: 12px; }
.py-md { padding-top: 20px; padding-bottom: 20px; }
.py-lg { padding-top: 32px; padding-bottom: 32px; }

.px-sm { padding-left: 12px; padding-right: 12px; }
.px-md { padding-left: 20px; padding-right: 20px; }
.px-lg { padding-left: 32px; padding-right: 32px; }

.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 20px; }
.mt-lg { margin-top: 32px; }

.mb-sm { margin-bottom: 12px; }
.mb-md { margin-bottom: 20px; }
.mb-lg { margin-bottom: 32px; }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.text-center { text-align: center; }
.text-muted { color: var(--gray-600); }
.text-bold { font-weight: 600; }
.text-danger { color: var(--red-400); font-size: 0.875rem; margin-top: 4px; }

.w-full { width: 100%; }

/* ==========================
   ALERTS
   ========================== */

.alert-warning {
    background: rgba(237, 137, 54, 0.1);
    border-left: 4px solid var(--orange-400);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-warning i {
    color: var(--orange-400);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-warning strong {
    color: var(--navy-900);
    display: block;
    margin-bottom: 4px;
}

.alert-warning p {
    color: var(--navy-700);
    margin: 0;
    line-height: 1.6;
}

.alert-error {
    background: rgba(252, 129, 129, 0.1);
    border-left: 4px solid var(--red-400);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-error i {
    color: var(--red-400);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-error strong {
    color: var(--navy-900);
    display: block;
    margin-bottom: 4px;
}

.alert-error pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.task-info {
    background: var(--gray-50);
    padding: 20px;
    border-radius: 12px;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.info-card-blue {
    background: rgba(66, 153, 225, 0.05);
    border-left: 4px solid var(--blue-400);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.info-card-blue i {
    color: var(--blue-400);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-card-blue p {
    margin: 8px 0;
    color: var(--navy-700);
    line-height: 1.6;
}

.warning-card {
    background: rgba(252, 129, 129, 0.05);
    border-left: 4px solid var(--red-400);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.warning-card i {
    color: var(--red-400);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-card p {
    margin: 8px 0;
    color: var(--navy-700);
    line-height: 1.6;
}

.stat-icon-blue {
    background: linear-gradient(135deg, var(--blue-400) 0%, #3182CE 100%);
}

.stat-icon-green {
    background: linear-gradient(135deg, var(--green-400) 0%, var(--green-500) 100%);
}

.tor-status-btn {
    position: relative;
    transition: all 0.3s ease;
}

.tor-status-btn[data-status="checking"] i {
    color: var(--gray-400);
}

.tor-status-btn[data-status="disconnected"] i {
    color: var(--gray-400);
}

.tor-status-btn[data-status="connected"] i {
    color: var(--green-400);
    filter: drop-shadow(0 0 4px var(--green-400));
}

.tor-status-btn[data-status="error"] i {
    color: var(--red-400);
}

.tor-status-btn:hover {
    transform: scale(1.1);
}

.tor-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.tor-info-item {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.tor-info-label {
    font-size: 0.875rem;
    color: var(--navy-600);
    margin-bottom: 8px;
    font-weight: 500;
}

.tor-info-label i {
    color: var(--primary-color);
    margin-right: 6px;
}

.tor-info-value {
    font-size: 1.1rem;
    color: var(--navy-800);
    font-weight: 600;
}

.status-connected {
    color: var(--green-500);
}

.status-error {
    color: var(--red-500);
}

.tor-help {
    background: rgba(66, 153, 225, 0.05);
    border-left: 4px solid var(--blue-400);
    border-radius: 8px;
    padding: 16px;
}

.tor-help h4 {
    color: var(--blue-400);
    margin-bottom: 12px;
    font-size: 1rem;
}

.tor-help ol {
    margin-left: 20px;
    color: var(--navy-700);
    line-height: 1.8;
}

.tor-help ol li {
    margin: 8px 0;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 12px;
}

/* ==========================
   FORM HELPERS
   ========================== */

.form-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.4;
}

.error-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--red-400);
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.divider {
    text-align: center;
    margin: 24px 0;
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: var(--gray-300);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* ==========================
   SHOP SELECTOR
   ========================== */

.shops-selector {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.selected-info {
    padding: 10px 16px;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 8px;
    color: var(--green-500);
    font-weight: 600;
    font-size: 0.9rem;
    display: none;
    align-items: center;
    gap: 12px;
}

/* ==========================
   MODAL
   ========================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    border: none;
    width: 90%;
    max-width: 1200px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy-900);
}

.close {
    color: var(--gray-600);
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
}

.close:hover,
.close:focus {
    color: var(--navy-900);
}

.modal-body {
    padding: 28px;
    max-height: 65vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--gray-200);
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================
   SHOP CONTROLS
   ========================== */

.shops-controls {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: 12px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    margin: 0;
    font-weight: 600;
    color: var(--navy-800);
    font-size: 0.9rem;
}

.control-group .range-input {
    width: 100px;
    padding: 8px 12px;
}

.shops-count {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-300);
    font-size: 0.9rem;
    color: var(--navy-700);
}

.shops-count strong {
    color: var(--teal-600);
    font-weight: 700;
}

/* ==========================
   TABLE ENHANCEMENTS
   ========================== */

.purity-table tbody tr.selected {
    background: rgba(72, 187, 120, 0.1);
}

.purity-table tbody tr.selected:hover {
    background: rgba(72, 187, 120, 0.15);
}

.purity-table .loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-600);
    font-style: italic;
}

.purity-table code {
    font-size: 0.85rem;
    color: var(--teal-600);
    background: rgba(79, 209, 197, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* ==========================
   RESPONSIVE - EXTENDED
   ========================== */

@media (max-width: 992px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .page-hero {
        padding: 28px;
    }
    
    .card, .form-card {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .page-hero-title {
        font-size: 1.5rem;
    }
    
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-search {
        max-width: 100%;
    }
    
    .purity-table {
        font-size: 0.85rem;
    }
    
    .purity-table thead th,
    .purity-table tbody td {
        padding: 12px 16px;
    }
    
    .table-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn-primary,
    .button-group .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}
