:root {
    /* Pleasant Theme Palette */
    --primary: #8b5cf6;
    --secondary: #ec4899;
    --accent: #3b82f6;
    --dark: #0f172a;
    --light: #f8fafc;

    --glass: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    --text-main: #94a3b8;
    --text-muted: #64748b;

    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);

    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

body.dashboard-mode {
    align-items: flex-start;
    padding-top: 2rem;
}

.background-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    animation: move 10s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: #4c1d95;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    opacity: 0.5;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: #be185d;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation-delay: -5s;
    opacity: 0.5;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 300px;
    height: 300px;
    background: #ec4899;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation-duration: 15s;
    opacity: 0.4;
}

@keyframes move {
    from {
        transform: translate(0, 0) rotate(0deg);
    }

    to {
        transform: translate(20px, 40px) rotate(20deg);
    }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 1rem;
    margin: 0.5rem;
}

.dashboard-container {
    width: 100%;
    max-width: 1400px;
    padding: 1rem;
    margin: 0 auto;
}

.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: 2rem;
}

/* Header & Text */
header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.header-text {
    text-align: left;
}

.app-logo {
    width: 51px;
    height: 51px;
    max-width: 51px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.4));
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    background: linear-gradient(to right, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
    text-align: left;
}

p {
    line-height: 1.5;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    text-align: left;
}

/* --- FORM & LANDING PAGE COMPONENT STYLES (Restored) --- */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #818cf8;
    font-weight: 400;
}

.file-upload-box {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    cursor: pointer;
}

.file-upload-box:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.file-upload-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.file-upload-box input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.or-divider {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.5rem 0;
}

.file-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    pointer-events: none;
}

.file-name {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
}

.file-name.active {
    color: #4ade80;
}

.image-preview {
    display: block;
    max-width: 150px;
    max-height: 100px;
    margin: 1rem auto;
    border-radius: 8px;
    border: 2px solid var(--glass-border);
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.submit-btn .glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.submit-btn:hover .glow {
    opacity: 1;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.error-alert {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.validation-msg {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}

.validation-msg.error {
    color: #f87171;
}

.validation-msg.success {
    color: #4ade80;
}

.validation-msg.info {
    color: var(--text-muted);
}

.header-actions {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.download-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #c4b5fd;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.download-link:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.glass-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #c4b5fd;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0 1.2rem;
    height: 48px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: inherit;
}

.glass-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.icon-small {
    width: 16px;
    height: 16px;
}

/* Inputs and Selects */
.glass-input {
    width: 100%;
    height: 48px;
    padding: 0 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.glass-input option {
    background: var(--dark);
    color: var(--text-main);
}

.select-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s;
}

.select-wrapper:hover::after {
    color: var(--primary);
}

.spinner-small {
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: 3rem;
    top: 50%;
    margin-top: -0.6rem;
}

/* SSO Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.sso-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- DASHBOARD STYLES --- */

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-main);
    font-size: 0.9rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Nav top-right avatar — larger */
#user-avatar {
    width: 42px;
    height: 42px;
}

.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-input {
    min-width: 150px;
    flex: 1;
}

/* Per-dropdown width overrides */
#project-dropdown-wrapper {
    flex: 3;
}

#filter-year-wrapper {
    flex: 0.4;
    min-width: 110px;
    max-width: 145px;
}

#filter-month-wrapper {
    flex: 0.6;
    min-width: 130px;
    max-width: 175px;
}

#filter-status-wrapper {
    flex: 0.65;
    min-width: 140px;
    max-width: 185px;
}

#filter-creator-wrapper {
    flex: 1;
    min-width: 140px;
}

/* Searchable Dropdown */
.searchable-dropdown {
    position: relative;
}

.searchable-dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    white-space: nowrap;
    box-sizing: border-box;
    width: 100%;
}

.searchable-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.searchable-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: 360px;
    background: rgba(18, 20, 40, 0.98);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    backdrop-filter: blur(24px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
}

.project-search-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.project-search-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.project-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#project-options-list {
    max-height: 230px;
    overflow-y: auto;
    padding: 4px 0 6px;
}

#project-options-list::-webkit-scrollbar {
    width: 4px;
}

#project-options-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.project-option {
    padding: 9px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.15s ease;
    border-radius: 0;
}

.project-option:hover {
    background: rgba(99, 102, 241, 0.15);
    color: white;
}

.project-option.active {
    background: rgba(99, 102, 241, 0.2);
    font-weight: 600;
    color: white;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.report-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.report-card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.2rem;
}

.report-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.week-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.1);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.2);
    white-space: nowrap;
}

.card-body {
    flex-grow: 1;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-app_user {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.status-project_manager {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.status-delivery_manager {
    background: rgba(236, 72, 153, 0.2);
    color: #f9a8d4;
}

.status-super_admin {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.status-created {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.status-sent {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.card-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1rem;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: 6px;
}

.action-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.btn-download:hover {
    color: var(--info);
}

.btn-send:hover {
    color: var(--success);
}

.btn-delete:hover {
    color: var(--danger);
}

/* Admin Table */
.admin-table-container {
    overflow-x: auto;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.glass-table th,
.glass-table td {
    padding: 0.4rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.glass-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- REVISED DASHBOARD TABLE STYLES --- */

.table-container {
    overflow-x: auto;
    /* Ensure horizontal scroll on small screens */
    width: 100%;
}

.report-table {
    width: 100%;
    border-collapse: separate;
    /* Allows for border-radius on rows/cells if needed */
    border-spacing: 0;
    margin-bottom: 0.5rem;
}

.report-table th,
.report-table td {
    padding: 0.75rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    vertical-align: middle;
}

.report-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.report-table tr {
    transition: background 0.2s;
}

.report-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.report-table tr:last-child td {
    border-bottom: none;
}

/* User Cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Action Buttons in a Row */
.action-buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}

.icon-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-view:hover {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.3);
}

.btn-send:hover {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.3);
}

.btn-delete:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
}

/* Typography */
.font-medium {
    font-weight: 500;
    color: white;
    font-size: 0.95rem;
}

.text-sm {
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
}

/* Pagination Improvements */
.pagination-btn {
    min-width: 35px;
    padding: 0 8px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-color, #94a3b8);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--primary, #8b5cf6);
    color: white;
}

.pagination-btn.active {
    background: var(--primary, #8b5cf6);
    color: white;
    border-color: var(--primary, #8b5cf6);
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--text-muted, #64748b);
}