:root {
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.1);
    --accent: #6c5ce7;
    --accent-hover: #5649c0;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --danger: #d63031;
}

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

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

.background-glob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 90%;
    max-width: 800px;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: -2px;
    background: linear-gradient(to right, #6c5ce7, #a29bfe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.05);
}

/* file inputs are hidden; JS triggers them via button clicks */

.upload-prompt svg {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-prompt p {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upload-prompt span.desktop-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Mobile camera / library action buttons */
.mobile-upload-btns {
    display: none; /* shown only on mobile via JS */
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
    width: 100%;
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
}

.mobile-upload-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}

.mobile-upload-btn:first-child {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
}

.mobile-upload-btn:first-child:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.4);
}

.mobile-upload-btn:last-child {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.mobile-upload-btn:last-child:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
}

.file-list {
    margin-top: 1rem;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-word;
    white-space: pre-wrap;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 1rem;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: 0.3s;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}





.mb-3 {
    margin-bottom: 1rem;
}

small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.position-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-label {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #dfe6e9;
    font-size: 0.85rem;
    transition: 0.2s;
    user-select: none;
}

.radio-label input {
    display: none;
}

.radio-label:has(input:checked) {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

button {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 6px rgba(108, 92, 231, 0.2);
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(108, 92, 231, 0.3);
}

button:active {
    transform: translateY(0);
}

.hidden {
    display: none;
}

.progress-container {
    width: 100%;
    height: 6px;
    background: #dfe6e9;
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a29bfe);
    width: 0%;
    transition: width 0.1s linear;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
    padding: 1.5rem;
    box-sizing: border-box;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    margin: auto;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

body.modal-open {
    overflow: hidden;
    height: 100vh;
}

#statusMessage {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    min-height: 20px;
}

.error {
    color: var(--danger);
}

.success {
    color: #00b894;
}

/* Unified Navigation Menu */
.nav-menu {
    display: flex;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    margin-bottom: 2rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}

.nav-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 4px rgba(108, 92, 231, 0.3);
}

/* Footer Styles */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-content {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--accent);
}

.footer-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1), transparent);
    margin: 1rem 0;
}

.footer-copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-heart {
    color: #e74c3c;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    .container {
        width: 95%;
    }

    .card,
    .receipts-section {
        padding: 1.25rem !important;
    }

    header h1 {
        font-size: 2.25rem;
    }

    /* Make Navigation Stack */
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        width: 100%;
    }

    .nav-item {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    /* Resize Dropzone */
    .upload-area {
        padding: 1.5rem 1rem;
    }

    /* Convert Table to Stacked Cards */
    #receiptsTable thead {
        display: none;
    }

    #receiptsTable, #receiptsTable tbody, #receiptsTable tr, #receiptsTable td {
        display: block;
        width: 100%;
    }

    #receiptsTable tr {
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.4);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    }

    #receiptsTable td {
        padding: 0.25rem 0 !important;
        text-align: left;
        border: none !important;
    }

    #receiptsTable td:first-child {
        word-break: break-word;
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    #receiptsTable td:nth-child(2) {
        margin-bottom: 0.5rem;
    }

    #receiptsTable td:nth-child(3) {
        text-align: right;
    }

    .detail-card {
        padding: 1.25rem;
        gap: 1.5rem;
    }

    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination button {
        width: 100% !important;
    }

    /* Modal Mobile Adjustments */
    .modal-content {
        padding: 2rem 1.5rem;
    }

    .modal-content h3 {
        padding-right: 2rem; /* Avoid overlap with close button */
        font-size: 1.25rem;
    }

    .delete-actions {
        flex-direction: column-reverse;
        gap: 0.75rem !important;
    }

    .delete-actions button {
        width: 100% !important;
    }

    /* Larger touch targets for close buttons */
    .icon-btn {
        padding: 12px !important;
        font-size: 1.75rem !important;
    }
}

/* Icon Buttons (Resets global button styles) */
.icon-btn {
    width: auto;
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
    border: none;
    padding: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: none;
    box-shadow: none;
}

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

.icon-btn.danger:hover {
    background: rgba(214, 48, 49, 0.1);
}