/* assets/css/admin.css - Complete Consolidated Version */

/* ===========================
   CSS Variables
   =========================== */
:root {
    --admin-primary: #2c3e50;
    --admin-secondary: #3498db;
    --admin-success: #27ae60;
    --admin-danger: #e74c3c;
    --admin-warning: #f39c12;
    --admin-light: #ecf0f1;
    --admin-dark: #34495e;
    --admin-sidebar-width: 250px;
    --admin-header-height: 60px;
}

/* ===========================
   Global Reset and Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f8f9fa;
    color: #333;
}

.admin-body {
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

/* ===========================
   Admin Login Page
   =========================== */
.admin-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.admin-login-box {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    padding: 3rem;
}

.admin-login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.admin-login-header img {
    max-height: 60px;
    margin-bottom: 1rem;
}

.admin-login-header h2 {
    font-size: 1.5rem;
    color: var(--admin-primary);
    margin-bottom: 0.5rem;
}

.admin-login-header p {
    color: #7f8c8d;
}

.admin-login-footer {
    text-align: center;
    margin-top: 2rem;
}

.admin-login-footer a {
    color: var(--admin-secondary);
    text-decoration: none;
    font-size: 0.9rem;
}

.admin-login-footer a:hover {
    text-decoration: underline;
}

/* Login Form */
.admin-login-form .form-group {
    margin-bottom: 1.5rem;
}

.admin-login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--admin-primary);
    font-weight: 500;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--admin-secondary);
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0.5rem;
}

.admin-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.admin-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--admin-primary);
    font-weight: normal;
}

/* ===========================
   Admin Dashboard Header
   =========================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-section img {
    height: 35px;
}

.logo-section span {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.logout-button:hover {
    background: #c0392b;
}

/* ===========================
   Admin Dashboard Layout
   =========================== */
.layout {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    background: none;
    color: rgba(255,255,255,0.8);
    width: 100%;
    text-align: left;
    font-size: 14px;
    text-decoration: none;
}

.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-right: 4px solid #3498db;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    background: #f8f9fa;
    overflow-x: auto;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.page-header p {
    color: #7f8c8d;
    font-size: 16px;
}

/* ===========================
   Dashboard Components
   =========================== */
/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.stat-content h3 {
    font-size: 32px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-content p {
    color: #7f8c8d;
    font-size: 14px;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Recent Posts */
.recent-posts {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 25px;
}

.recent-posts h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.post-item {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.post-item h3 {
    color: #2c3e50;
    font-size: 16px;
    margin-bottom: 8px;
}

.post-meta {
    color: #7f8c8d;
    font-size: 14px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ===========================
   Tables
   =========================== */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.table-header h2 {
    color: #2c3e50;
    font-size: 20px;
}

.table-wrapper {
    overflow-x: auto;
}

.posts-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.posts-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
}

.posts-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.posts-table tr:hover {
    background: #f8f9fa;
}

/* Action Buttons */
.actions-cell {
    width: 200px;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-edit {
    background: #27ae60;
    color: white;
}

.btn-edit:hover {
    background: #229954;
    transform: translateY(-1px);
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Category Badge */
.category-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.category-fundraising { background: #e3f2fd; color: #1976d2; }
.category-strategy { background: #f3e5f5; color: #7b1fa2; }
.category-operations { background: #e8f5e9; color: #388e3c; }
.category-technology { background: #fff3e0; color: #f57c00; }

/* ===========================
   Forms
   =========================== */
.form-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: white;
    color: #2c3e50;
    border: 2px solid #e0e0e0;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #f5f7fa;
}

/* Editor */
.editor-container {
    margin: 20px 0;
}

#editor {
    min-height: 300px;
}

/* Image Upload Styles */
.image-upload-area {
    position: relative;
    margin-top: 10px;
}

.image-upload-area input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-upload-area input[type="file"]:hover {
    border-color: #3498db;
    background: #fff;
}

.image-preview {
    margin-top: 15px;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-preview button {
    display: block;
    margin-top: 10px;
}

/* ===========================
   Messages
   =========================== */
.message {
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error,
.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error-message {
    padding: 1rem;
    border-radius: 5px;
    margin-top: 1rem;
    display: none;
}

.edit-note {
    background: #e3f2fd;
    color: #1976d2;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
    }

    .nav-item {
        white-space: nowrap;
    }

    .main-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .posts-table {
        font-size: 0.85rem;
    }

    .posts-table th,
    .posts-table td {
        padding: 0.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}