/* Admin Panel Styles */
:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #8b5cf6;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

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

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

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

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

.login-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-header .logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.login-header p {
    color: var(--gray-500);
}

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

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

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 14px;
    width: 14px;
    text-align: center;
    pointer-events: none;
}

.input-icon input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.2s;
}

.input-icon input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-icon input::placeholder {
    color: var(--gray-400);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.login-footer a {
    color: var(--gray-500);
    font-size: 14px;
}

.login-footer a:hover {
    color: var(--primary);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

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

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    color: white;
}

.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-nav {
    padding: 16px;
}

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

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

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

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-size: 14px;
}

.admin-user i {
    font-size: 24px;
}

/* Page Content */
.page-content {
    padding: 24px;
}

/* ==================== FLASH MESSAGES ==================== */
.flash-messages {
    padding: 0;
    margin-bottom: 16px;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

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

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

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

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.6;
}

.flash-close:hover {
    opacity: 1;
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--gray-500);
    margin-top: 4px;
}

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

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

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

.stat-icon-primary {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary);
}

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

.stat-icon-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

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

.stat-icon-secondary {
    background: rgba(139, 92, 246, 0.1);
    color: var(--secondary);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
}

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

/* ==================== DASHBOARD GRID ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* ==================== CARDS ==================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

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

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

.table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

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

.row-unread {
    background: rgba(14, 165, 233, 0.05);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

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

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

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

.btn-block {
    width: 100%;
}

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

.badge-primary {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary);
}

.badge-secondary {
    background: rgba(139, 92, 246, 0.1);
    color: var(--secondary);
}

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

.status-new {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-read {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary);
}

.status-replied {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-archived {
    background: rgba(107, 114, 128, 0.1);
    color: var(--gray-500);
}

/* ==================== FILTER BAR ==================== */
.filter-bar {
    margin-bottom: 20px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 100px;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

/* ==================== FORMS ==================== */
.form-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 16px;
}

.form-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox */
.checkbox-group {
    margin-top: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

/* Dynamic Fields */
.dynamic-field {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.dynamic-field input {
    flex: 1;
}

.specs-field input:first-child {
    width: 40%;
}

.specs-field input:last-of-type {
    flex: 1;
}

.remove-btn {
    padding: 8px 12px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius);
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: var(--danger);
    color: white;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    margin-top: 24px;
}

/* ==================== PRODUCT TABLE STYLES ==================== */
.product-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-icon {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.action-buttons {
    display: flex;
    gap: 4px;
}

.toggle-btn {
    padding: 6px 10px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius);
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: var(--warning);
    color: white;
}

.toggle-btn.active {
    background: var(--warning);
    color: white;
}

/* ==================== MESSAGE STYLES ==================== */
.message-list {
    display: flex;
    flex-direction: column;
}

.message-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius);
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.message-item:hover {
    background: var(--gray-50);
}

.message-item.unread {
    background: rgba(14, 165, 233, 0.05);
}

.message-avatar {
    font-size: 36px;
    color: var(--gray-300);
}

.message-content {
    flex: 1;
    min-width: 0;
}

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

.message-time {
    font-size: 12px;
    color: var(--gray-400);
}

.message-subject {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.message-preview {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-600);
    transition: all 0.2s;
}

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

.quick-action-btn i {
    font-size: 24px;
    margin-bottom: 8px;
}

.quick-action-btn span {
    font-size: 13px;
    font-weight: 500;
}

/* Message Detail */
.message-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.message-detail-card .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.message-date {
    font-size: 13px;
    color: var(--gray-500);
}

.message-text {
    white-space: pre-wrap;
    line-height: 1.8;
}

.contact-info-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.contact-info-item:last-child {
    border-bottom: none;
}

.info-icon {
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
}

.info-content label {
    font-size: 12px;
    color: var(--gray-500);
}

.info-content p {
    font-weight: 500;
    color: var(--dark);
}

.info-content a {
    color: var(--primary);
}

/* Status Actions */
.status-actions {
    display: flex;
    gap: 8px;
}

.status-btn {
    flex: 1;
    padding: 12px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.status-btn:hover {
    background: var(--gray-200);
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 16px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .dashboard-grid,
    .message-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .page-header {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 12px 8px;
    }
}
