/* Custom styles for the website */

:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --accent-color: #f59e0b;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --header-bg: #f0f9ff;
    --footer-bg: #f0f9ff;
}

html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: border-box;
}

header {
    background: linear-gradient(135deg, var(--header-bg) 0%, #e0f2fe 100%);
    color: #1f2937;
    padding: 1.5em 2em;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.1);
    border-bottom: 2px solid var(--primary-light);
    width: 100%;
}

header a {
    color: #1f2937;
    text-decoration: none;
    margin-right: 1em;
    transition: opacity 0.3s ease;
}

header a:hover {
    opacity: 0.7;
}

nav a:hover {
    text-decoration: underline;
}

/* Main content grows to fill remaining space */
main.container {
    flex: 1;
    padding: 2.5em;
    max-width: none;
    margin: 0 auto;
    width: min(90vw, 2200px);
    box-sizing: border-box;
}

.accounts-wide main.container {
    max-width: none;
    width: 100%;
    padding-left: 1.25em;
    padding-right: 1.25em;
}

footer {
    background: linear-gradient(135deg, var(--footer-bg) 0%, #e0f2fe 100%);
    color: #1f2937;
    text-align: center;
    padding: 2em;
    border-top: 2px solid var(--primary-light);
    margin-top: auto;
    width: 100%;
}

/* Optional: spacing for content inside main */
.container {
    padding: 2.5em;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    header {
        padding: 1em;
    }
    
    main.container, .container {
        padding: 1em;
        width: 100%;
    }
    
    footer {
        padding: 1em;
    }
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 600;
    margin-top: 0;
}

h1 {
    font-size: 2.25em;
    margin-bottom: 0.5em;
    color: #1e40af;
}

h1 a {
    font-family: 'Pacifico', cursive;
    font-size: 1.3em;
    letter-spacing: 1px;
    color: #1e40af !important;
    text-decoration: none;
}

h2 {
    font-size: 1.875em;
    margin-bottom: 0.75em;
    border-bottom: 3px solid var(--primary-light);
    padding-bottom: 0.5em;
}

h3 {
    font-size: 1.5em;
    margin-bottom: 1em;
}

p {
    line-height: 1.6;
    color: var(--text-light);
}

.lead {
    font-size: 1.125em;
    line-height: 1.8;
}

/* Login overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Login card */
.login-card {
    background: white;
    padding: 2em;
    min-width: 320px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    gap: 1em;
}

/* Title */
.login-title {
    text-align: center;
    margin-bottom: 0.5em;
}

/* Input fields */
.login-input {
    width: 100%;
    padding: 0.5em 0.75em;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

/* Base button styles */
.login-btn,
.login-btn-secondary {
    display: flex;            /* use flex to center text */
    justify-content: center;  /* horizontal center */
    align-items: center;      /* vertical center */
    width: 100%;              /* full width */
    padding: 0.75em;          /* same padding for both */
    border-radius: 4px;
    font-size: 1em;
    text-decoration: none;    /* remove underline on <a> */
    cursor: pointer;
    box-sizing: border-box;   /* ensure padding doesn't break width */
}

/* Primary login button */
.login-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

/* Secondary button */
.login-btn-secondary {
    background-color: var(--text-light);
    color: white;
    border: none;
    margin-top: 0.5em;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn-secondary:hover {
    background-color: var(--text-dark);
    transform: translateY(-2px);
}

/* Dropdown container */
.dropdown {
    position: relative;
}

/* Dropdown menu (hidden by default) */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%; /* right below parent */
    left: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Dropdown menu items */
.dropdown-menu li a {
    display: block;
    padding: 0.5em 1em;
    color: #333;
    text-decoration: none;
}

.dropdown-menu li a:hover {
    background-color: #f2f2f2;
}

/* Show dropdown on hover */
.dropdown:hover .dropdown-menu {
    display: block;
}


/* Toast container fixed top-right */
.toast-container {
    position: fixed;
    top: 1em;
    right: 1em;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

/* Toast message */
.toast {
    min-width: 250px;
    padding: 0.75em 1em;
    border-radius: 4px;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.5s forwards, fadeOut 0.5s forwards 3.5s; /* appear then fade */
}

/* Toast colors */
.toast-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-success { background: linear-gradient(135deg, #10b981, #059669); }
.toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.toast-info { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateX(100%); }
}


/* Filters container */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    margin-bottom: 1.5em;
    align-items: center;
}

.filters label {
    font-weight: bold;
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
}

.filters select {
    padding: 0.4em 0.6em;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 0.9em;
    margin-top: 0.2em;
    transition: border-color 0.2s;
}

.filters select:focus {
    border-color: #0078d4;
    outline: none;
}

/* Modern table */
#inventory-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: inherit;
    font-size: 0.95em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
}

#inventory-table th, #inventory-table td {
    padding: 0.75em 1em;
    text-align: left;
}

#inventory-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

#inventory-table tbody tr {
    transition: background-color 0.2s, transform 0.1s;
    border-bottom: 1px solid var(--border-color);
}

#inventory-table tbody tr:hover {
    background-color: var(--bg-light);
    transform: translateY(-1px);
}

#inventory-table tbody td:first-child {
    text-align: center;
}

.have-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-light);
}

.have-counter {
    width: 60px;
    text-align: center;
    font-size: 0.9em;
    padding: 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: white;
}

.have-true {
    background-color: #d1fae5 !important;
    border-color: #6ee7b7 !important;
    color: #065f46;
}

.have-false {
    background-color: #fee2e2 !important;
    border-color: #fecaca !important;
    color: #991b1b;
}

/* Make table scrollable on small screens */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Optional: add a subtle shadow on the table container */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* make columns narrower on small screens */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    margin-bottom: 1.5em;
    align-items: center;
}

@media (max-width: 600px) {
    .filters {
        flex-direction: column;
        gap: 0.5em;
    }
}

/* make the table columns “stack” on very small screen */
@media (max-width: 500px) {
    #inventory-table, #inventory-table thead, #inventory-table tbody, 
    #inventory-table th, #inventory-table td, #inventory-table tr {
        display: block;
    }

    #inventory-table thead tr {
        display: none;
    }

    #inventory-table tbody tr {
        margin-bottom: 1em;
        border: 1px solid #ccc;
        border-radius: 8px;
        padding: 0.5em;
        background-color: #f9f9f9;
    }

    #inventory-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.4em 0.6em;
        border: none;
    }

    #inventory-table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
    }
}

/* Overlay */
.overlay-content {
    background: #fff;
    padding: 2em;
    border-radius: 10px;
    width: 300px;
    max-width: 90%;   /* ensures it shrinks on mobile */
    box-sizing: border-box;
}

.overlay-content form label {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.8em;
}

.overlay-content input, .overlay-content select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4em;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.counter-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2em;
}

.counter-btn {
    padding: 0.2em 0.6em;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: white;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    transition: background-color 0.2s, border-color 0.2s;
}

.counter-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.have-counter {
    width: 50px;
    text-align: center;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Overlay is hidden by default */
#add-item-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* Centered modal content */
#add-item-overlay .overlay-content {
    background: white;
    padding: 2em;
    border-radius: 10px;
    width: 300px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.remove-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    padding: 0.4em 0.8em;
    transition: transform 0.2s, box-shadow 0.2s;
}

.remove-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.remove-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Pure CSS Button Enhancements */
.pure-button {
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.pure-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pure-button-primary {
    background-color: var(--primary-light) !important;
    color: white !important;
}

.pure-button-primary:hover {
    background-color: var(--primary-color) !important;
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    padding: 0.75em !important;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    outline: none !important;
}

/* Menu sections */
section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    main.container {
        padding: 1.5em;
    }
    
    h1 {
        font-size: 1.75em;
    }
    
    h2 {
        font-size: 1.5em;
    }
}

.page-card-view-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #f8fafc;
}

.page-card-view-label {
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.page-card-view-controls .card-view-btn {
    padding: 6px 10px;
    min-width: 32px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.page-card-view-controls .card-view-btn.active {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1f2937;
}