/**
 * Rebus Telegram Bot Admin Panel
 * Modern, Clean Styles
 */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.logo-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
    font-weight: 700;
}

.login-box h1 {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 32px;
}

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

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

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-logout {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* ===== ADMIN LAYOUT ===== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

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

.user-name {
    font-weight: 500;
    color: var(--gray-600);
}

.content-container {
    padding: 24px;
}

/* ===== TABS ===== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 56px;
    height: 56px;
    background: var(--gray-100);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-label {
    color: var(--gray-500);
    font-size: 14px;
}

/* ===== CHART ===== */
.chart-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

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

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.chart-period-selector {
    display: flex;
    gap: 8px;
}

.period-btn {
    padding: 8px 16px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.period-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.period-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.chart-container {
    height: 300px;
}

/* ===== TABLES ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.search-box input {
    padding: 10px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    width: 280px;
    transition: var(--transition);
}

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

.table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

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

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

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

/* ===== BROADCAST ===== */
.broadcast-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

.editor-panel,
.preview-panel {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.editor-panel h3,
.preview-panel h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

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

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

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
    transition: var(--transition);
}

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

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

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--gray-100);
    border-radius: 8px;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.toolbar-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* File Upload */
.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.file-label:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.file-name {
    margin-left: 12px;
    color: var(--gray-600);
    font-size: 14px;
}

/* Checkbox */
.form-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.button-fields {
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-actions {
    margin-top: 24px;
}

/* ===== PREVIEW ===== */
.preview-container {
    display: flex;
    justify-content: center;
}

.preview-phone {
    width: 100%;
    max-width: 340px;
    background: #efeae2;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--primary);
    color: var(--white);
}

.preview-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.preview-name {
    font-weight: 500;
}

.preview-content {
    padding: 16px;
    min-height: 200px;
}

.preview-media {
    margin-bottom: 12px;
}

.preview-media img,
.preview-media video {
    max-width: 100%;
    border-radius: 8px;
}

.preview-text {
    background: var(--white);
    padding: 12px 14px;
    border-radius: 0 12px 12px 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.preview-text .placeholder-text {
    color: var(--gray-400);
    font-style: italic;
}

.preview-button {
    margin-top: 8px;
}

.preview-button a {
    display: block;
    text-align: center;
    padding: 10px;
    background: var(--white);
    color: var(--primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-sent {
    background: #d1fae5;
    color: #065f46;
}

.status-sending {
    background: #fef3c7;
    color: #92400e;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-draft {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ===== NOTIFICATIONS ===== */
#notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: var(--success);
    color: var(--white);
}

.notification-error {
    background: var(--danger);
    color: var(--white);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== MODAL ===== */
.modal {
    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;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 24px;
}

.progress-bar {
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.progress-status {
    margin-top: 12px;
    color: var(--gray-500);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .broadcast-container {
        grid-template-columns: 1fr;
    }
    
    .preview-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-period-selector {
        flex-wrap: wrap;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .content-container {
        padding: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .login-box {
        padding: 24px;
    }
}
