@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #059669;
    --primary-dark: #065f46;
    --primary-light: #d1fae5;
    --secondary: #6366f1;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 14px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --footer-bg: #1e293b;
    --footer-text: #ffffff;
}

body.dark-mode {
    --bg-main: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass: rgba(15, 23, 42, 0.85);
    --primary-light: #064e3b;
    --footer-bg: #020617;
    --footer-text: #cbd5e1;
}

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

body {
    font-family: 'Outfit', 'Montserrat', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== ADMIN HEADER ===== */
header.admin-header {
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 72px;
    z-index: 1100;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo img {
    height: 42px;
    display: block;
}

.header-nav {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.header-nav li a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.header-nav li a:hover, .header-nav li a.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-nav-action {
    background: var(--primary) !important;
    color: #fff !important;
    border-radius: 50px !important;
}

.btn-nav-action:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-1px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-theme {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-theme:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.admin-header.nav-open, .public-header.nav-open {
    z-index: 2005 !important;
}

.mobile-menu-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.mobile-nav-header {
    display: none;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    align-items: center;
    justify-content: space-between;
}

.mobile-nav-header img {
    height: 38px;
    width: auto;
}

.close-mobile-menu {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.close-mobile-menu:hover {
    color: var(--primary);
}

/* ===== USER PROFILE DROPDOWN ===== */
.user-dropdown { position: relative; }

.profile-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 6px 14px 6px 6px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--transition);
}

.profile-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

.profile-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1010;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

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

.user-dropdown:hover .dropdown-content { display: block; }

.dropdown-header {
    padding: 1rem;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
}

.dropdown-header .d-name { font-weight: 700; color: var(--primary-dark); }
.dropdown-header .d-role { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: var(--transition);
}

.dropdown-content a:hover { background: var(--bg-main); color: var(--primary); }

.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-link-danger { color: #ef4444 !important; }

/* ===== PUBLIC LANDING PAGE (index.php) ===== */
header.public-header {
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 80px;
    z-index: 1100;
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.public-header .nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    align-items: center;
}

.public-header .nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.public-header .nav-links a:hover {
    color: var(--primary);
}

.hero {
    position: relative;
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
}

#hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -2;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.4) 100%);
    z-index: -1;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    z-index: 10;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 3rem;
    font-weight: 400;
}

.tracking-bar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px;
    border-radius: 50px;
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.tracking-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0 1.5rem;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
}

.tracking-bar input::placeholder { color: rgba(255,255,255,0.6); }
.tracking-bar input:focus { outline: none; }

.tracking-bar button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.tracking-bar button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Sections */
.section {
    padding: 8rem 5%;
}

.text-center { text-align: center; }

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.section-subtitle {
    color: var(--text-muted);
    margin-bottom: 4rem;
    font-size: 1.1rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 3rem 2rem;
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 4rem 5% 2rem;
    transition: var(--transition);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 4rem;
}

.footer-info img { height: 60px; margin-bottom: 1.5rem; }
.footer-info p { opacity: 0.7; font-size: 0.9rem; color: var(--footer-text); }

.footer-links h4 { margin-bottom: 1.5rem; font-size: 1.1rem; color: var(--footer-text); }
.footer-links ul { list-style: none; }
.footer-links ul li { margin-bottom: 0.8rem; }
.footer-links ul li a { color: var(--footer-text); opacity: 0.7; text-decoration: none; transition: 0.2s; }
.footer-links ul li a:hover { opacity: 1; color: var(--primary); }

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    opacity: 0.7;
    color: var(--footer-text);
}

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    
    .header-nav, .nav-links {
        display: flex;
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        height: 100vh;
        background: var(--card-bg) !important;
        flex-direction: column;
        padding: 0;
        gap: 0;
        border-right: 1px solid var(--border);
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2010;
        overflow-y: auto;
    }

    .header-nav.active, .nav-links.active {
        left: 0;
    }

    .header-nav li, .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    .header-nav li a, .nav-links li a {
        display: block;
        padding: 1rem 1.5rem;
        border-radius: 0;
        width: 100%;
    }

    .header-nav li a:hover, .header-nav li a.active,
    .nav-links li a:hover, .nav-links li a.active {
        background: var(--primary-light);
        color: var(--primary-dark);
        border-left: 4px solid var(--primary);
    }

    .mobile-nav-header { display: flex; }
    
    /* Hero Adjustments */
    .hero-content {
        padding: 1.5rem;
    }

    .hero-content h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }

    .hero-content p {
        font-size: 1rem;
        margin-bottom: 2.5rem;
        padding: 0 10px;
    }

    .tracking-bar {
        flex-direction: column;
        border-radius: 20px;
        padding: 15px;
        gap: 15px;
        margin-left: 15px;
        margin-right: 15px;
    }

    .tracking-bar input {
        text-align: center;
        padding: 10px;
        width: 100%;
    }

    .tracking-bar button {
        width: 100%;
        padding: 1rem;
    }

    .dashboard-container { padding-left: 1rem; padding-right: 1rem; }
}

/* Nav Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-container {
    padding-top: 100px;
    padding-bottom: 4rem;
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.main-content h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card h3 { font-size: 1.8rem; font-weight: 700; }
.stat-card p { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

/* ===== TABLES ===== */
.table-container, .orders-table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

th {
    background: var(--bg-main);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:hover td { background: var(--bg-main); }
tr:last-child td { border-bottom: none; }

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-pendiente { background: #fef3c7; color: #92400e; }
.status-recogido { background: #e0f2fe; color: #075985; }
.status-en_camino { background: #dbeafe; color: #1e40af; }
.status-entregado { background: #d1fae5; color: #065f46; }
.status-incidencia { background: #fee2e2; color: #991b1b; }

body.dark-mode .status-pendiente { background: #78350f; color: #fef3c7; }
body.dark-mode .status-recogido { background: #0c4a6e; color: #e0f2fe; }
body.dark-mode .status-en_camino { background: #1e3a8a; color: #dbeafe; }
body.dark-mode .status-entregado { background: #064e3b; color: #d1fae5; }
body.dark-mode .status-incidencia { background: #7f1d1d; color: #fee2e2; }

/* Action Buttons */
.btn-action {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-edit { color: var(--secondary); }
.btn-delete { color: #ef4444; }

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 540px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    padding: 2.5rem;
    position: relative;
    animation: modalScale 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 2rem; color: var(--text-main); }

.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

.btn-submit:hover { background: var(--primary-dark); transform: scale(1.02); }
