:root {
    --primary-gold: #C9A961;
    --primary-dark: #1a1f2e;
    --primary-blue: #2d3748;
    --accent-teal: #48bb78;
    --accent-orange: #ed8936;
    --bg-light: #f7fafc;
    --bg-card: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #C9A961 0%, #8B7355 100%);
    --gradient-secondary: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    --gradient-accent: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(201, 169, 97, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(72, 187, 120, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(45, 55, 72, 0.03) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 30s ease infinite;
}

@keyframes bgShift {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(2deg);
    }
}

/* =============== LOGIN SCREEN =============== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--gradient-secondary);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.1) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

.login-box {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    padding: 50px 45px;
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 480px;
    width: 100%;
    position: relative;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    width: 150px;
    height: auto;
    margin: 0 auto 25px;
    /* background: var(--gradient-primary); */
    /* border-radius: 20px; */
    display: block;
    /* align-items: center;
    justify-content: center;
    font-size: 2.5em; */
    /* box-shadow: var(--shadow-lg); */
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.login-box h1 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 2em;
    text-align: center;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.login-box p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 35px;
    font-size: 1.05em;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95em;
    transition: color 0.2s;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1em;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-card);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.1);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.05em;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: white;
}

.btn-success {
    background: var(--gradient-accent);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-light);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-light);
}

.login-error {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: none;
    text-align: center;
    font-weight: 600;
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.login-info {
    background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%);
    color: #2c5282;
    padding: 20px;
    border-radius: 12px;
    margin-top: 24px;
    font-size: 0.9em;
    line-height: 1.7;
}

.login-info strong {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
}

/* =============== MAIN APP =============== */
.app-container {
    display: none;
    animation: fadeIn 0.5s;
}

.app-container.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Header */
.header {
    background: var(--bg-card);
    padding: 30px 35px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.header-content h1 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 2.2em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header-content p {
    color: var(--text-secondary);
    font-size: 1.05em;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95em;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge::before {
    content: '👤';
    font-size: 1.2em;
}

.logout-btn {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Admin Dashboard */
.admin-dashboard {
    background: var(--bg-card);
    padding: 35px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
    display: none;
}

.admin-dashboard.active {
    display: block;
    animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-dashboard h2 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-light);
    flex-wrap: wrap;
}

.admin-tab {
    padding: 14px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 1em;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-family: 'Tajawal', sans-serif;
}

.admin-tab:hover {
    color: var(--text-primary);
}

.admin-tab.active {
    color: var(--primary-gold);
    border-bottom-color: var(--primary-gold);
}

.admin-content {
    display: none;
}

.admin-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Main Content Grid */
.main-content {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.form-section {
    background: var(--bg-card);
    padding: 35px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    height: fit-content;
    border: 1px solid var(--border-light);
    position: sticky;
    top: 30px;
}

.form-section h2 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 1.6em;
    color: var(--text-primary);
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-section {
    background: var(--bg-card);
    padding: 35px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.map-section h2 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 1.6em;
    color: var(--text-primary);
    margin-bottom: 20px;
}

#map {
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 28px;
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-family: 'Almarai', sans-serif;
    font-size: 2.5em;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.stat-card p {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
}

/* Projects Section */
.projects-section {
    background: var(--bg-card);
    padding: 35px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.projects-section h2 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary-gold);
}

.filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-section select,
.filter-section input {
    padding: 12px 18px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1em;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s;
    background: var(--bg-card);
}

.filter-section select:focus,
.filter-section input:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.1);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.project-card {
    background: var(--bg-card);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-gold);
}

.project-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
}

.project-info {
    padding: 24px;
}

.project-info h3 {
    font-family: 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 1.35em;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.project-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.project-detail:last-of-type {
    border-bottom: none;
}

.project-detail span:first-child {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9em;
}

.project-detail span:last-child {
    color: var(--text-primary);
    font-weight: 700;
}

.project-notes {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-light);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
}

.added-by-badge {
    display: inline-block;
    background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%);
    color: #2c5282;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    margin-top: 12px;
}

.project-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-small {
    padding: 10px 18px;
    font-size: 0.9em;
    flex: 1;
    border-radius: 10px;
}

/* Image Preview */
.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.image-preview img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--border-light);
    transition: all 0.3s;
}

.image-preview img:hover {
    transform: scale(1.05);
    border-color: var(--primary-gold);
}

/* Notification */
.notification {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    padding: 20px 35px;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    display: none;
    font-weight: 700;
    border: 1px solid var(--border-light);
    animation: notificationSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notificationSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.notification.success {
    border-right: 5px solid #48bb78;
    color: #22543d;
}

.notification.info {
    border-right: 5px solid #4299e1;
    color: #2c5282;
}

.notification.error {
    border-right: 5px solid #fc8181;
    color: #742a2a;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 32, 44, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 24px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-muted);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    background: var(--bg-light);
}

.modal-close:hover {
    background: var(--border-light);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.modal-images img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.modal-images img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.loading::after {
    content: '';
    display: block;
    margin: 20px auto 0;
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tables */
.users-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
}

.users-table th,
.users-table td {
    padding: 16px 20px;
    text-align: right;
}

.users-table th {
    background: var(--bg-light);
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-light);
    font-size: 0.95em;
}

.users-table td {
    border-bottom: 1px solid var(--border-light);
}

.users-table tr:hover td {
    background: var(--bg-light);
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .form-section {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    .header-content h1 {
        font-size: 1.6em;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        flex-direction: column;
    }

    .admin-tab {
        text-align: center;
    }
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8B7355;
}