/* ============================================
   CSS VARIABLES FOR THEME SUPPORT
   ============================================ */

:root {
    /* Dark Theme (Default) */
    --bg-primary: #1a1d2e;
    --bg-secondary: #22263a;
    --bg-tertiary: #2d3250;
    --bg-hover: #363b52;

    --text-primary: #ffffff;
    --text-secondary: #e4e6eb;
    --text-muted: #9ca3af;
    --text-disabled: #6b7280;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-light: rgba(255, 255, 255, 0.05);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-purple: #8b5cf6;
    --accent-purple-light: #a78bfa;

    --success: #10b981;
    --success-dark: #059669;
    --success-light: #34d399;

    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-light: #f87171;

    --warning: #fb923c;
    --info: #60a5fa;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9fafb;
    --bg-hover: #e5e7eb;

    --text-primary: #111827;
    --text-secondary: #1f2937;
    --text-muted: #6b7280;
    --text-disabled: #9ca3af;

    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-light: rgba(0, 0, 0, 0.05);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-secondary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

.header {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    color: var(--text-secondary);
}

.header h1 {
    color: var(--text-primary);
    font-size: 32px;
    margin-bottom: 10px;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(20deg);
}

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

.stat-card {
    background: var(--bg-tertiary);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color-light);
    transition: all 0.3s ease;
    position: relative;
}

.stat-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-purple);
    margin-bottom: 15px;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
    color: var(--accent-purple-light);
    opacity: 1;
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    color: var(--text-primary);
    font-size: 36px;
    font-weight: 700;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

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

.tab {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color-light);
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab svg {
    width: 20px;
    height: 20px;
    transition: all 0.3s;
}

.tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.tab-content {
    display: none;
    background: var(--bg-tertiary);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.tab-content h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 24px;
}

.tab-content p {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color-light);
    width: 100%;
}

.panel h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 20px;
}

.action-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.btn:active svg {
    transform: rotate(180deg);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th {
    background: var(--bg-tertiary);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color-light);
    font-size: 13px;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color-light);
    font-size: 13px;
    color: var(--text-secondary);
}

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

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.badge-pending {
    background: rgba(251, 146, 60, 0.2);
    color: var(--warning);
}

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

.badge-revoked,
.badge-rejected {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

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

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
    max-width: 400px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.notification.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 20px 0;
}

.pagination button {
    min-width: 40px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color-light);
}

.pagination button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.pagination span {
    color: var(--text-muted);
    padding: 0 5px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.search-box {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.3s;
}

.search-box:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

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

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: var(--accent-purple-light);
}

/* Chat/Support Styles */
.ticket-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.ticket-card:hover {
    border-color: var(--accent-primary);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.ticket-card.unread {
    border-left: 4px solid var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
}

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

.ticket-subject {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ticket-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.ticket-status.open {
    background: rgba(251, 146, 60, 0.2);
    color: var(--warning);
}

.ticket-status.replied {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.ticket-status.closed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-light);
}

.ticket-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: var(--text-disabled);
    margin-top: 10px;
    flex-wrap: wrap;
}

.ticket-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.chat-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.chat-header {
    padding: 20px;
    border-bottom: 2px solid var(--border-color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 20px;
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-primary);
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-start;
}

.message.admin {
    align-items: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-bottom-left-radius: 4px;
}

.message.admin .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-meta {
    font-size: 11px;
    color: var(--text-disabled);
    margin-top: 4px;
    padding: 0 8px;
}

.chat-input-container {
    padding: 20px;
    border-top: 2px solid var(--border-color-light);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.chat-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color-light);
    background: var(--bg-primary);
}

.close-btn {
    background: var(--bg-tertiary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.3s;
    color: var(--text-muted);
}

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

/* Search wrapper with icon */
.search-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s ease;
}

.search-box {
    padding-left: 45px !important;
}

.search-wrapper:focus-within .search-icon {
    color: var(--accent-primary);
}

/* ================================
 *   📱 RESPONSIVE DESIGN
 *   ================================ */

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .header>div {
        flex-direction: column;
        gap: 15px;
    }

    .header h1 {
        font-size: 24px;
    }

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

    .stat-card {
        padding: 20px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        width: 100%;
        justify-content: center;
    }

    .panel {
        padding: 20px;
    }

    .action-bar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 10px 8px;
    }

    .modal-content {
        padding: 20px;
    }

    .ticket-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .ticket-subject {
        font-size: 16px;
    }

    .ticket-meta {
        flex-direction: column;
        gap: 8px;
        font-size: 13px;
    }

    .ticket-status {
        font-size: 11px;
        padding: 3px 10px;
    }

    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ticket-subject {
        font-size: 15px;
        width: 100%;
    }

    .action-bar select {
        width: 100% !important;
        max-width: 100% !important;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .theme-toggle {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .tab {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .tab {
        min-height: 44px;
    }

    .tab:hover {
        transform: none;
    }

    .stat-card:hover {
        transform: none;
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile First: 320px - 767px */
@media (max-width: 767px) {

    /* Base Layout */
    body {
        padding: 12px;
    }

    .container {
        padding: 0;
    }

    /* Header */
    .header {
        padding: 16px;
        border-radius: 12px;
    }

    .header h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .header p {
        font-size: 14px;
    }

    /* Header Buttons */
    .header-buttons {
        display: flex;
        gap: 8px;
        margin-top: 12px;
        flex-wrap: wrap;
    }

    .theme-toggle,
    .logout-btn {
        padding: 8px 16px;
        font-size: 14px;
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    /* Stats Grid - Single Column */
    .stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-card .value {
        font-size: 32px;
    }

    /* Tabs - Vertical Stack */
    .tabs {
        flex-direction: column;
        gap: 10px;
        overflow-x: visible;
        overflow-y: visible;
    }

    .tab {
        padding: 14px 20px;
        font-size: 15px;
        white-space: normal;
        width: 100%;
        text-align: center;
        border-radius: 10px;
    }

    .tab.active {
        background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    }

    /* Remove custom scrollbar styles for tabs */
    .tabs::-webkit-scrollbar {
        display: none;
    }

    /* Panel */
    .panel {
        padding: 16px;
        border-radius: 12px;
    }

    .panel h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    /* Action Bar */
    .action-bar {
        flex-direction: column;
        gap: 10px;
    }

    .action-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* Search Box */
    .search-box {
        width: 100%;
        max-width: none;
    }

    /* Tables - Hide on Mobile (except in modals), use cards instead */
    .table-wrapper {
        display: none;
    }

    /* Show tables in modals with scroll */
    .modal .table-wrapper {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal table {
        min-width: 500px;
        font-size: 12px;
    }

    .modal th,
    .modal td {
        padding: 10px 8px;
        font-size: 11px;
    }

    /* Mobile Card Layout for table data */
    .mobile-card {
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        transition: all 0.3s ease;
    }

    .mobile-card:active {
        transform: scale(0.98);
        background: var(--bg-hover);
    }

    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-color-light);
    }

    .mobile-card-title {
        font-weight: 600;
        color: var(--text-primary);
        font-size: 15px;
        flex: 1;
    }

    .mobile-card-badge {
        margin-left: 8px;
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        font-size: 13px;
    }

    .mobile-card-label {
        color: var(--text-muted);
        font-weight: 500;
    }

    .mobile-card-value {
        color: var(--text-secondary);
        text-align: right;
        font-family: monospace;
        word-break: break-all;
    }

    .mobile-card-actions {
        display: flex;
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color-light);
    }

    .mobile-card-actions .btn {
        flex: 1;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        max-height: 90vh;
        margin: 20px 0;
    }

    .modal-header {
        font-size: 20px;
        margin-bottom: 16px;
    }

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

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 14px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
    }

    .pagination button {
        min-width: 36px;
        padding: 8px;
        font-size: 13px;
    }

    /* Chat/Support */
    .ticket-card {
        padding: 16px;
    }

    .ticket-subject {
        font-size: 16px;
    }

    .chat-container {
        max-width: 100%;
        max-height: 90vh;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-header h3 {
        font-size: 18px;
    }

    .chat-messages {
        padding: 16px;
    }

    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .chat-input-container {
        padding: 16px;
    }

    /* Revenue Cards */
    .revenue-card {
        padding: 16px;
    }

    .revenue-amount {
        font-size: 28px;
    }

    /* Notification */
    .notification {
        right: 12px;
        top: 12px;
        left: 12px;
        max-width: none;
        padding: 16px;
    }

    /* Empty State */
    .empty-state {
        padding: 40px 16px;
    }

    .empty-state svg {
        width: 60px;
        height: 60px;
    }

    /* Badge */
    .badge {
        padding: 3px 10px;
        font-size: 10px;
    }

    /* Settings Sections */
    .settings-section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .settings-section h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* Revenue History */
    .revenue-history-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* License Details */
    .license-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Week Range */
    .week-range {
        font-size: 13px;
    }
}

/* Tablet: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    body {
        padding: 16px;
    }

    .header {
        padding: 24px;
    }

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

    /* Stats Grid - 2 Columns */
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Tabs */
    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        padding: 14px 24px;
        font-size: 15px;
    }

    /* Panel */
    .panel {
        padding: 24px;
    }

    /* Show tables, hide mobile cards */
    .table-wrapper {
        display: block;
    }

    .mobile-card {
        display: none;
    }

    /* Tables */
    table {
        font-size: 14px;
    }

    th,
    td {
        padding: 14px 12px;
    }

    /* Modals */
    .modal-content {
        width: 90%;
        max-width: 600px;
        padding: 24px;
    }

    /* Action Bar */
    .action-bar {
        flex-wrap: wrap;
    }

    .action-bar .btn {
        flex: 1;
        min-width: 140px;
    }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {

    /* Stats Grid - 4 Columns */
    .stats {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Ensure proper spacing */
    .header {
        padding: 30px;
    }

    .panel {
        padding: 30px;
    }

    /* Show tables, hide mobile cards */
    .table-wrapper {
        display: block;
    }

    .mobile-card {
        display: none;
    }
}

/* Landscape on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        max-height: 85vh;
    }

    .chat-container {
        max-height: 85vh;
    }

    body {
        padding: 12px 20px;
    }
}

/* Extra small devices (very small phones) */
@media (max-width: 374px) {
    .header h1 {
        font-size: 20px;
    }

    .stat-card .value {
        font-size: 28px;
    }

    .tab {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .modal-content {
        padding: 16px;
    }

    table {
        min-width: 500px;
    }

    /* Revenue history table - force scroll */
    .revenue-history-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .revenue-history-table table {
        min-width: 600px;
    }

    /* Settings sections */
    .settings-section {
        padding: 12px;
    }

    /* Collapsible sections */
    .settings-toggle {
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .header-buttons,
    .tabs,
    .action-bar,
    .theme-toggle,
    .logout-btn {
        display: none;
    }

    .panel {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .stat-card {
        break-inside: avoid;
    }
}