/* ==========================================================================
   Admin Dashboard Styles
   ========================================================================== */

:root {
    --color-primary: #123045;
    --color-primary-dark: #0a1c2d;
    --color-primary-light: #1a4563;
    --color-secondary: #5a8a8a;
    --color-accent: #e87722;
    --color-white: #ffffff;
    --color-gray-100: #f1f3f5;
    --color-gray-200: #e9ecef;
    --color-gray-300: #dee2e6;
    --color-gray-500: #adb5bd;
    --color-gray-700: #495057;
    --color-gray-800: #343a40;
    --color-gray-900: #212529;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--color-gray-100);
    color: var(--color-gray-900);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Login Screen
   ========================================================================== */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.login-header h1 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--color-gray-600);
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-gray-700);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.error-message {
    color: var(--color-danger);
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* ==========================================================================
   Dashboard Layout
   ========================================================================== */

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--color-primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 0.5rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 3px solid var(--color-accent);
}

.nav-icon {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.badge {
    margin-left: auto;
    background: var(--color-accent);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
}

.content-area {
    flex: 1;
    padding: 2rem;
}

.content-section {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Stats & Overview
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.8;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

.recent-contacts {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recent-contacts h2 {
    margin-bottom: 1.5rem;
    color: var(--color-primary);
}

/* ==========================================================================
   Section Headers
   ========================================================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    color: var(--color-primary);
    font-size: 1.75rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-gray-300);
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--color-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ==========================================================================
   Items List
   ========================================================================== */

.items-list,
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-card,
.contact-item {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}

.item-content {
    flex: 1;
}

.item-content h3 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.item-subtitle {
    color: var(--color-gray-600);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.item-description {
    color: var(--color-gray-700);
    margin-top: 0.5rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.contact-message {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--color-gray-100);
    border-radius: 0.5rem;
}

.contact-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-new { background: #fff3cd; color: #856404; }
.status-read { background: #d1ecf1; color: #0c5460; }
.status-replied { background: #d4edda; color: #155724; }
.status-archived { background: var(--color-gray-300); color: var(--color-gray-700); }

.contact-date {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

.contact-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.contact-actions select {
    padding: 0.5rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 0.5rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-family);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-gray-300);
    color: var(--color-gray-900);
}

.btn-secondary:hover {
    background: var(--color-gray-400);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h3 {
    color: var(--color-primary);
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-gray-600);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    color: var(--color-gray-900);
}

.modal-body {
    padding: 2rem;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-gray-700);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-gray-200);
}

.settings-form {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: var(--color-success);
    color: white;
}

.notification-error {
    background: var(--color-danger);
    color: white;
}

.notification-info {
    background: var(--color-primary);
    color: white;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-gray-600);
}

/* ==========================================================================
   Photo Upload
   ========================================================================== */

.photo-upload-container {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--color-gray-300);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-500);
    font-size: 0.875rem;
}

.photo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.loading-state {
    text-align: center;
    padding: 2rem;
    color: var(--color-gray-500);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* ==========================================================================
   Dark Mode
   ========================================================================== */

body.dark-mode {
    --color-gray-100: #1a1a1a;
    --color-gray-200: #2d2d2d;
    --color-gray-300: #404040;
    --color-gray-500: #6b6b6b;
    --color-gray-700: #9a9a9a;
    --color-gray-800: #b3b3b3;
    --color-gray-900: #ffffff;
    --color-white: #1a1a1a;
    background: #0f0f0f;
    color: #ffffff;
}

body.dark-mode .stat-card,
body.dark-mode .item-card,
body.dark-mode .contact-item,
body.dark-mode .recent-contacts,
body.dark-mode .quick-actions-card,
body.dark-mode .modal,
body.dark-mode .topbar,
body.dark-mode .settings-form {
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
}

body.dark-mode .login-container {
    background: #1a1a1a;
    color: #ffffff;
}

/* ==========================================================================
   Enhanced Topbar
   ========================================================================== */

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--color-gray-600);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.breadcrumb::before {
    content: '📍';
    margin-right: 0.25rem;
}

.topbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    width: 300px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    width: 400px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    pointer-events: none;
}

.search-input-small {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    width: 200px;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    position: relative;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--color-gray-200);
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--color-danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ==========================================================================
   Welcome Banner & Enhanced Stats
   ========================================================================== */

.welcome-banner {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(18, 48, 69, 0.3);
    animation: slideDown 0.5s;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-content h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.welcome-stats {
    display: flex;
    gap: 2rem;
}

.mini-stat {
    text-align: center;
}

.mini-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.mini-stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.stat-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stat-card:hover .stat-sparkle {
    animation: sparkle 1s infinite;
}

.stat-sparkle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover .stat-sparkle {
    opacity: 1;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.5; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
}

.stat-trend {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--color-success);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.quick-actions-card {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-actions-card h2 {
    margin-bottom: 1.5rem;
    color: var(--color-primary);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-gray-100);
    border: 2px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-family: var(--font-family);
    font-size: 0.875rem;
}

.quick-action-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.qa-icon {
    font-size: 1.5rem;
}

.section-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    position: relative;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner-ring {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.spinner-ring:nth-child(2) {
    width: 40px;
    height: 40px;
    border-width: 3px;
    animation-duration: 0.8s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 20px;
    height: 20px;
    border-width: 2px;
    animation-duration: 0.6s;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 1rem;
    margin-top: 1rem;
}

/* ==========================================================================
   Easter Eggs & Fun Features
   ========================================================================== */

.easter-egg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20000;
    pointer-events: none;
}

.easter-egg.active {
    animation: confetti 3s ease-out;
}

@keyframes confetti {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* ==========================================================================
   Keyboard Shortcuts Modal
   ========================================================================== */

.modal-small {
    max-width: 500px;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--color-gray-100);
    border-radius: 0.5rem;
}

.shortcut-item kbd {
    background: var(--color-gray-200);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Enhanced Animations
   ========================================================================== */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.bounce {
    animation: bounce 1s infinite;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .item-card,
    .contact-item {
        flex-direction: column;
    }

    .item-actions,
    .contact-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .search-input {
        width: 200px;
    }

    .search-input:focus {
        width: 250px;
    }
}

/* ==========================================================================
   Fun Stats & Additional Features
   ========================================================================== */

.fun-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fun-stat-item {
    padding: 1rem;
    background: var(--color-gray-100);
    border-radius: 0.5rem;
    border-left: 4px solid var(--color-primary);
    transition: all 0.3s;
}

.fun-stat-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fun-stat-item strong {
    color: var(--color-primary);
    margin-right: 0.5rem;
}
