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

:root {
    --wood-dark: #4E342E;
    --wood-medium: #6D4C41;
    --wood-light: #8D6E63;
    --wood-pale: #BCAAA4;
    --cream: #EFEBE9;
    --cream-light: #FAF8F6;
    --orange: #E65100;
    --orange-light: #FF8F00;
    --green: #2E7D32;
    --green-light: #4CAF50;
    --red: #C62828;
    --red-light: #EF5350;
    --blue: #1565C0;
    --text-dark: #3E2723;
    --text-medium: #5D4037;
    --text-light: #8D6E63;
    --shadow: rgba(78, 52, 46, 0.3);
    --shadow-strong: rgba(78, 52, 46, 0.5);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--cream);
    color: var(--text-dark);
    min-height: 100vh;
}

/* Wood texture background */
.wood-bg {
    background-color: var(--wood-medium);
    background-image: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.03) 2px,
            rgba(0,0,0,0.03) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 50px,
            rgba(255,255,255,0.02) 50px,
            rgba(255,255,255,0.02) 51px
        );
}

.wood-panel {
    background: linear-gradient(135deg, var(--cream-light) 0%, var(--cream) 100%);
    border: 3px solid var(--wood-light);
    border-radius: 12px;
    box-shadow: 
        0 4px 12px var(--shadow),
        inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
}

.wood-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 9px;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 80px,
            rgba(139,110,99,0.05) 80px,
            rgba(139,110,99,0.05) 82px
        );
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
    color: white;
    box-shadow: 0 3px 8px rgba(230, 81, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 81, 0, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--wood-medium) 0%, var(--wood-light) 100%);
    color: white;
    box-shadow: 0 3px 8px var(--shadow);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-strong);
}

.btn-success {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%);
    color: white;
    box-shadow: 0 3px 8px rgba(46, 125, 50, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-light) 100%);
    color: white;
    box-shadow: 0 3px 8px rgba(198, 40, 40, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(198, 40, 40, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--wood-light);
    color: var(--wood-medium);
}

.btn-outline:hover {
    background: var(--wood-light);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Form inputs */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-medium);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--wood-pale);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235D4037' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 2px solid var(--wood-pale);
}

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

thead {
    background: linear-gradient(135deg, var(--wood-medium) 0%, var(--wood-dark) 100%);
    color: white;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cream);
    font-size: 14px;
}

tbody tr:hover {
    background-color: var(--cream-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(46, 125, 50, 0.15);
    color: var(--green);
}

.badge-warning {
    background: rgba(255, 143, 0, 0.15);
    color: var(--orange);
}

.badge-danger {
    background: rgba(198, 40, 40, 0.15);
    color: var(--red);
}

.badge-info {
    background: rgba(21, 101, 192, 0.15);
    color: var(--blue);
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(62, 39, 35, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 3px solid var(--wood-light);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--wood-medium) 0%, var(--wood-dark) 100%);
    color: white;
    border-radius: 13px 13px 0 0;
}

.modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.3);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 2px solid var(--cream);
    background: var(--cream-light);
    border-radius: 0 0 13px 13px;
}

/* Alerts / Notifications */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: rgba(46, 125, 50, 0.1);
    border-left: 4px solid var(--green);
    color: var(--green);
}

.alert-warning {
    background: rgba(255, 143, 0, 0.1);
    border-left: 4px solid var(--orange);
    color: var(--orange);
}

.alert-danger {
    background: rgba(198, 40, 40, 0.1);
    border-left: 4px solid var(--red);
    color: var(--red);
}

.alert-info {
    background: rgba(21, 101, 192, 0.1);
    border-left: 4px solid var(--blue);
    color: var(--blue);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-warning { background: var(--orange); }
.toast-info { background: var(--blue); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Search bar */
.search-bar {
    position: relative;
    max-width: 400px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 2px solid var(--wood-pale);
    border-radius: 25px;
    font-size: 14px;
    background: white;
    transition: all 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--wood-pale);
    box-shadow: 0 3px 10px var(--shadow);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--cream);
}

::-webkit-scrollbar-thumb {
    background: var(--wood-pale);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--wood-light);
}

/* Confirm dialog */
.confirm-dialog {
    text-align: center;
}

.confirm-dialog .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirm-dialog p {
    font-size: 16px;
    color: var(--text-medium);
    margin-bottom: 8px;
}

.confirm-dialog .sub-text {
    font-size: 13px;
    color: var(--text-light);
}

/* Page title */
.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.page-title h2 {
    font-size: 24px;
    color: var(--wood-dark);
}

.page-title .subtitle {
    font-size: 14px;
    color: var(--text-light);
}

/* Action bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-bar {
        max-width: 100%;
    }
    
    .modal {
        width: 95%;
        margin: 10px;
    }
    .modal-body {
        padding: 16px !important;
    }
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    .form-control {
        padding: 12px;
        font-size: 16px;
    }
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        min-width: 600px;
    }
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .modal {
        width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    .modal-body {
        padding: 12px !important;
    }
    .flex {
        flex-wrap: wrap;
    }
    .flex .btn {
        flex: 1;
        min-width: calc(50% - 4px);
    }
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
