:root {
    --primary: #84cc16;
    --primary-dark: #65a30d;
    --bg: #0f172a;
    --bg-light: #1e293b;
    --bg-lighter: #334155;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #cbd5e1;
    --danger: #ef4444;
    --danger-dark: #dc2626;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a, a:visited {
    color: var(--primary);
    text-decoration: none;
}

a.btn, a.btn:visited {
    color: var(--text);
}

a.btn-primary, a.btn-primary:visited {
    color: #000000;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.nav-brand {
    margin: 0;
    padding: 0;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary) !important;
    display: flex;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.navbar-logo {
    height: 80px;
    width: auto;
    display: block;
    margin: 0;
    padding: 0;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

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

.nav-menu a:hover {
    color: var(--primary);
    text-decoration: none;
}

.user-menu {
    position: relative;
}

.user-icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    width: 24px;
    transition: color 0.2s;
}

.user-icon-btn:hover {
    color: var(--primary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 150px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-dropdown.active {
    display: flex;
}

.user-dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s, color 0.2s;
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background: var(--bg-lighter);
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--bg-lighter);
    color: var(--text);
    transition: all 0.2s;
}

.btn:hover {
    opacity: 0.9;
    text-decoration: none;
    color: var(--text);
}

.btn-primary {
    background: var(--primary);
    color: #000000;
    border-color: var(--primary);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #000000;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-dark);
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* Cards */
.card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

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

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.stat-card-clickable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card-clickable:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(132, 204, 22, 0.1);
}

/* Grid layouts */
.box-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.box-card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.box-card:hover {
    border-color: var(--primary);
}

.clickable-card {
    cursor: pointer;
}

.clickable-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(132, 204, 22, 0.1);
}

.box-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.box-card-placeholder {
    width: 100%;
    height: 180px;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}

.box-card-body {
    padding: 1rem;
}

.box-card-body h3 {
    margin-bottom: 0.25rem;
}

.box-card-body .box-number {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.box-card-body .box-location {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.box-card-body .box-items-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.box-card-actions {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.box-card-actions form {
    display: inline;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: auto;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
}

/* Items list */
.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th,
.items-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.items-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.items-table tr:hover {
    background: var(--bg-lighter);
}

.item-row {
    cursor: pointer;
}

/* Item thumbnails */
.item-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: block;
}

.item-thumb-placeholder {
    width: 40px;
    height: 40px;
    background: var(--bg-lighter);
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* Photo thumb with delete button */
.photo-thumb {
    position: relative;
    display: inline-block;
}

.photo-thumb img {
    display: block;
}

.photo-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: 1px solid var(--danger);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

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

/* Photos */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.photo-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.photo-gallery img:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.photo-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.photo-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.photo-modal-close:hover {
    color: var(--primary);
}

.box-photo-large {
    max-width: 400px;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

/* Detail sections */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.detail-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row .detail-label {
    width: 150px;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.detail-row .detail-value {
    flex: 1;
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary);
}

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

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

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

/* Danger zone */
.danger-zone {
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.danger-zone h3 {
    color: var(--danger);
    margin-bottom: 0.75rem;
}

/* Custom attributes */
.attribute-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    align-items: end;
}

.attribute-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.attribute-row .btn {
    margin-bottom: 0;
    align-self: flex-end;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

/* Auth pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg), var(--bg-light));
}

.auth-card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .box-grid {
        grid-template-columns: 1fr;
    }

    .detail-row {
        flex-direction: column;
    }

    .attribute-row {
        flex-direction: column;
    }
}

/* SweetAlert2 Dark Theme Customization */
.swal2-container {
    z-index: 10001;
}

.swal2-popup {
    background: var(--bg-light);
    color: var(--text);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.swal2-title {
    color: var(--text);
}

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

.swal2-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.swal2-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.1);
}

.swal2-textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.swal2-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.1);
}

.swal2-select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.swal2-select:focus {
    border-color: var(--primary);
}

.swal2-checkbox {
    background: var(--bg);
}

.swal2-radio {
    background: var(--bg);
}

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

.swal2-progress-ring {
    stroke: var(--primary);
}

.swal2-icon {
    border-color: var(--border);
}

.swal2-icon.swal2-warning {
    border-color: #f59e0b;
    color: #f59e0b;
}

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

.swal2-icon.swal2-success {
    border-color: #10b981;
    color: #10b981;
}

.swal2-icon.swal2-info {
    border-color: var(--primary);
    color: var(--primary);
}

.swal2-icon.swal2-question {
    border-color: var(--text-muted);
    color: var(--text-muted);
}
