/* Optimized Monochrome Admin Panel Styles */

:root {
    --primary-bg: #ffffff;
    --secondary-bg: #f8f9fa;
    --tertiary-bg: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.15);
    --transition: all 0.15s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

/* Navigation */
.navbar {
    background: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--secondary-bg);
    color: var(--text-primary);
}

.nav-links a.logout {
    background: var(--text-primary);
    color: var(--primary-bg);
}

.nav-links a.logout:hover {
    background: var(--text-secondary);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

h2, h3, h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
}

.chart-card {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.chart-card canvas {
    max-height: 300px !important;
    width: 100% !important;
}

/* Search and Filters */
.search-filter-bar {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-filter-bar input,
.search-filter-bar select {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-filter-bar input:focus,
.search-filter-bar select:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--primary-bg);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.table th {
    background: var(--secondary-bg);
    color: var(--text-primary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.table tr:hover {
    background: var(--tertiary-bg);
}

.table input {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    width: 80px;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.table input:focus {
    outline: none;
    border-color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--text-primary);
    color: var(--primary-bg);
    border-color: var(--text-primary);
}

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

.btn-success {
    background: var(--text-primary);
    color: var(--primary-bg);
    border-color: var(--text-primary);
}

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

.btn-danger {
    background: var(--text-primary);
    color: var(--primary-bg);
    border-color: var(--text-primary);
}

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

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Cards */
.card {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Tariff Items */
.tariff-item {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.tariff-item:hover {
    box-shadow: var(--shadow-lg);
}

.tariff-item .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Log Container */
.log-container {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-line {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.log-line:hover {
    background: var(--tertiary-bg);
}

.log-line.info { color: var(--text-secondary); }
.log-line.warning { color: var(--text-primary); font-weight: 500; }
.log-line.error { color: var(--text-primary); font-weight: 600; }
.log-line.critical { color: var(--text-primary); font-weight: 700; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-text { background: var(--secondary-bg); color: var(--text-primary); }
.badge-photo { background: var(--tertiary-bg); color: var(--text-primary); }
.badge-success { background: var(--secondary-bg); color: var(--text-primary); }
.badge-danger { background: var(--tertiary-bg); color: var(--text-primary); }

/* Messages */
#message {
    margin-top: 1rem;
}

.success {
    background: var(--secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    text-align: center;
    font-weight: 500;
}

.error-msg {
    background: var(--tertiary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    text-align: center;
    font-weight: 500;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.error {
    color: var(--text-primary);
    margin-top: 1rem;
    text-align: center;
    font-weight: 500;
}

/* Progress Bars */
.progress {
    height: 1.5rem;
    background: var(--secondary-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: var(--text-primary);
    border-radius: 0.75rem;
    transition: width 0.3s ease;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--text-primary);
    animation: spin 1s linear infinite;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 3px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--secondary-bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--secondary-bg);
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    .navbar {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-brand {
        font-size: 1.25rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }

    .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .container {
        padding: 0 0.75rem;
        margin: 0.75rem auto;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .value {
        font-size: 1.5rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .chart-card {
        padding: 1rem;
    }

    .search-filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .search-filter-bar input,
    .search-filter-bar select {
        min-width: 100%;
        font-size: 0.85rem;
    }

    .table {
        font-size: 0.75rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .btn-small {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .card {
        margin-bottom: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .tariff-item {
        padding: 1rem;
    }

    .tariff-item .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .login-card {
        padding: 1.25rem;
        margin: 0.75rem;
    }

    .login-card h1 {
        font-size: 1.5rem;
    }

    .modal-container {
        max-width: 95%;
        margin: 1rem;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    .log-container {
        font-size: 0.75rem;
        max-height: 300px;
    }

    .theme-toggle {
        width: 2.5rem;
        height: 2.5rem;
        bottom: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    .navbar {
        padding: 0.5rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .container {
        padding: 0 0.5rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    .stat-card .value {
        font-size: 1.25rem;
    }

    .table {
        font-size: 0.7rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--secondary-bg);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 1px;
}

/* Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .navbar,
    .btn,
    .theme-toggle {
        display: none !important;
    }
}
