/* ============================================================================
   SMS Reporter - Client Dashboard Styles
   ============================================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ============================================================================
   Screen Management
   ============================================================================ */

.screen {
    min-height: 100vh;
}

.screen.hidden {
    display: none;
}

/* ============================================================================
   Login Screen
   ============================================================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-card h1 {
    font-size: 32px;
    margin-bottom: 8px;
    text-align: center;
}

.login-card .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.admin-access-divider {
    margin: 30px 0 20px;
    text-align: center;
    position: relative;
}

.admin-access-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
}

.admin-access-divider span {
    background: white;
    padding: 0 15px;
    color: #999;
    font-size: 12px;
    position: relative;
}

.admin-access-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-access-section input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 12px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    color: #c33;
    font-size: 14px;
}

/* ============================================================================
   Dashboard Header
   ============================================================================ */

.dashboard-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

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

.client-name {
    color: #666;
    font-size: 14px;
}

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

.admin-indicator {
    padding: 6px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #856404;
}

.admin-indicator.hidden {
    display: none;
}

.view-toggle {
    display: none;
    gap: 5px;
}

.btn-toggle {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle:hover {
    background: #e0e0e0;
}

.btn-toggle.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-secondary {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

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

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

/* ============================================================================
   Dashboard Main
   ============================================================================ */

.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.dashboard-main section {
    margin-bottom: 40px;
}

.dashboard-main h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}

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

/* ============================================================================
   Stats Section
   ============================================================================ */

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #333;
}

/* ============================================================================
   Platform Section
   ============================================================================ */

.platform-stats {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

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

.platform-icon {
    font-size: 24px;
}

.platform-label {
    font-weight: 500;
    min-width: 80px;
}

.platform-count {
    font-size: 20px;
    font-weight: 600;
    color: #667eea;
}

/* ============================================================================
   Reports Section
   ============================================================================ */

.reports-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-collapse: collapse;
}

.reports-table thead {
    background: #f8f9fa;
}

.reports-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

.reports-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.reports-table tbody tr:hover {
    background: #f8f9fa;
}

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

.monospace {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.message-cell {
    max-width: 300px;
}

.message-preview {
    cursor: pointer;
    color: #667eea;
    text-decoration: underline;
}

.message-preview:hover {
    color: #5568d3;
}

.message-full {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 8px;
}

.platform-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.platform-ios {
    background: #e3f2fd;
    color: #1976d2;
}

.platform-android {
    background: #e8f5e9;
    color: #388e3c;
}

.platform-unknown {
    background: #f5f5f5;
    color: #666;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-sent {
    background: #d4edda;
    color: #155724;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================================================
   Pagination
   ============================================================================ */

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

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

/* ============================================================================
   Loading & Empty States
   ============================================================================ */

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    background: white;
    border-radius: 8px;
}

.error-state {
    text-align: center;
    padding: 40px;
    color: #c33;
    background: #fee;
    border-radius: 8px;
    border: 1px solid #fcc;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .reports-table {
        font-size: 12px;
    }

    .reports-table th,
    .reports-table td {
        padding: 8px;
    }

    .message-cell {
        max-width: 150px;
    }

    .platform-stats {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }

    .dashboard-main {
        padding: 20px 10px;
    }

    .reports-table {
        display: block;
        overflow-x: auto;
    }
}

/* ============================================================================
   Admin Tabs
   ============================================================================ */

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

.admin-tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    transition: all 0.3s;
    font-family: inherit;
}

.admin-tab-btn:hover {
    color: #333;
    background: #f5f5f5;
}

.admin-tab-btn.active {
    color: #dc3545;
    border-bottom-color: #dc3545;
    font-weight: bold;
}

.admin-tab-content {
    animation: fadeIn 0.3s;
}

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

/* Badge styling */
.badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e9ecef;
    color: #495057;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

/* ============================================================================
   Modal Styles
   ============================================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.modal-close:hover {
    color: #333;
}

.modal-content form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-actions .btn-secondary {
    margin-right: auto;
}
