/* Modern Dark Theme ISP Billing System */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --primary: #667eea;
    --accent-orange: #ff6b35;
    --accent-orange-hover: #ff8555;
    --accent-blue: #667eea;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: #2a2a2a;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Light Theme */
:root[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #eef2ff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --primary: #2563eb;
    --accent-orange: #2563eb;
    --accent-orange-hover: #1d4ed8;
    --accent-blue: #2563eb;
    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --border-color: #e5e7eb;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Ocean Theme */
:root[data-theme="ocean"] {
    --bg-primary: #06121f;
    --bg-secondary: #0b1e33;
    --bg-card: #0e253d;
    --bg-hover: #123154;
    --text-primary: #e6f0ff;
    --text-secondary: #9bb0c9;
    --primary: #06b6d4;
    --accent-orange: #06b6d4;
    --accent-orange-hover: #0891b2;
    --accent-blue: #06b6d4;
    --accent-green: #22c55e;
    --accent-red: #fb7185;
    --border-color: #173454;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 4px;
}

.brand-icon {
    color: var(--accent-orange);
    font-size: 22px;
}

.sidebar-logo h2 {
    color: var(--accent-orange);
    font-size: 22px;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left: 4px solid var(--accent-orange);
}

.sidebar-menu a i {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
}

/* Submenu Styles */
.has-submenu > a {
    position: relative;
    justify-content: space-between;
}

.submenu-arrow {
    margin-left: auto;
    margin-right: 0 !important;
    font-size: 12px !important;
    transition: transform 0.3s ease;
    width: auto !important;
}

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.has-submenu.open .submenu {
    max-height: 200px;
}

.submenu li {
    margin-bottom: 0;
}

.submenu a {
    padding: 10px 20px 10px 45px;
    font-size: 14px;
}

.submenu a i {
    font-size: 14px;
    width: 16px;
}

.submenu a:hover,
.submenu a.active {
    background: rgba(255, 107, 53, 0.2);
    border-left: 3px solid var(--accent-orange);
}

/* Menu Dividers */
.menu-divider {
    padding: 15px 20px 8px 20px;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-divider span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.menu-divider:first-child {
    border-top: none;
    margin-top: 0;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

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

.stat-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card-icon.orange {
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent-orange);
}

.stat-card-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.stat-card-icon.red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Content Card */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

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

.content-card-title {
    font-size: 20px;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--accent-orange);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-orange-hover);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: #0ea572;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-secondary:hover {
    background: #303030;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-primary);
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: background 0.3s;
}

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

/* Badges */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.badge-warning {
    background: rgba(255, 107, 53, 0.2);
    color: var(--accent-orange);
}

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

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
}

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

.login-header h1 {
    color: var(--accent-orange);
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-bar input {
    padding-left: 45px;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    overflow: auto;
}

.modal-content {
    background: var(--bg-card);
    margin: 50px auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
}

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

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    /* Sidebar Mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    /* Stats Grid Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Header Mobile */
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .header-actions > * {
        width: 100%;
    }
    
    /* Content Card Mobile */
    .content-card {
        padding: 15px;
    }
    
    .content-card-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    /* Table Mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    /* Buttons Mobile */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Modal Mobile */
    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    /* Form Mobile */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Search Bar Mobile */
    .search-bar {
        width: 100% !important;
    }
    
    /* Stat Card Mobile */
    .stat-card {
        padding: 20px;
    }
    
    .stat-card-value {
        font-size: 28px;
    }
    
    /* Login Card Mobile */
    .login-card {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .stat-card-value {
        font-size: 24px;
    }
    
    .content-card-title {
        font-size: 18px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Tablet Landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--accent-orange);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 998;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.gap-10 {
    gap: 10px;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}
