/* ==================================================
   Bamchi Telegram Bot - Admin Panel Styles
   RTL, Responsive, Clean, Professional
   ================================================== */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, 'Vazirmatn', Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
    direction: rtl;
}

a { color: #1976d2; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==================================================
   Login Page
   ================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.login-header p {
    color: #666;
}

/* ==================================================
   Admin Layout
   ================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #1a237e;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

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

.sidebar-header h2 {
    font-size: 1.3rem;
    margin: 0;
}

.sidebar-subtitle {
    font-size: 0.8rem;
    opacity: 0.7;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-right-color: #64b5f6;
}

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

.logout-link { color: #ef5350 !important; }

.main-content {
    flex: 1;
    margin-right: 250px;
    min-height: 100vh;
}

.top-bar {
    background: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-left {
    font-weight: 500;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.content-area {
    padding: 1.5rem;
}

/* ==================================================
   Cards
   ================================================== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    font-size: 1rem;
    margin: 0;
    color: #333;
}

.card-body {
    padding: 1.5rem;
}

/* ==================================================
   Page Header
   ================================================== */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.page-actions {
    margin-right: auto;
    display: flex;
    gap: 0.5rem;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-top: 3px solid #1976d2;
}

.stat-card.stat-success { border-top-color: #4caf50; }
.stat-card.stat-secondary { border-top-color: #9e9e9e; }
.stat-card.stat-info { border-top-color: #2196f3; }

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.stat-label {
    color: #666;
    margin-top: 0.25rem;
}

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

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

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

.table th,
.table td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
}

.table tbody tr:hover {
    background: #f9f9f9;
}

/* ==================================================
   Badges
   ================================================== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-secondary { background: #f5f5f5; color: #616161; }

/* ==================================================
   Buttons
   ================================================== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
    line-height: 1.5;
}

.btn:hover { text-decoration: none; opacity: 0.9; }

.btn-primary { background: #1976d2; color: white; }
.btn-success { background: #4caf50; color: white; }
.btn-danger { background: #e53935; color: white; }
.btn-secondary { background: #9e9e9e; color: white; }
.btn-full { display: block; width: 100%; }

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25,118,210,0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: auto;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    color: #888;
    font-size: 0.8rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* ==================================================
   Search & Filter
   ================================================== */
.search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* ==================================================
   Alerts
   ================================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* ==================================================
   Pagination
   ================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-btn:hover {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
    text-decoration: none;
}

.page-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* ==================================================
   Messages (Support)
   ================================================== */
.messages-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 80%;
}

.message-user {
    background: #e3f2fd;
    margin-left: auto;
    margin-right: 0;
}

.message-admin {
    background: #e8f5e9;
    margin-right: auto;
    margin-left: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.message-sender { font-weight: 600; }
.message-time { color: #888; }

.message-body {
    font-size: 0.9rem;
    line-height: 1.5;
}

.message-media {
    color: #1976d2;
    font-weight: 500;
}

.conv-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.info-item {
    padding: 0.5rem 0;
}

.info-grid {
    display: grid;
    gap: 0.5rem;
}

/* ==================================================
   Settings
   ================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.settings-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ==================================================
   Activity List
   ================================================== */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    font-size: 0.85rem;
}

.activity-action { font-weight: 600; }
.activity-detail { color: #666; }
.activity-admin { color: #1976d2; }
.activity-time { color: #999; white-space: nowrap; }

/* ==================================================
   Text Utilities
   ================================================== */
.text-muted { color: #999; }
code {
    background: #f5f5f5;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.mt-2 { margin-top: 1rem; }

/* ==================================================
   Responsive
   ================================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .menu-toggle {
        display: block;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .activity-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .message {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }
}
