@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    --primary: #0d3a73; /* Navy/FBK Blue */
    --primary-hover: #1e40af;
    --bg-color: #f1f5f9; /* Light Grayish Blue */
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #cbd5e1;
    --accent: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Auth Layout (Login/Register) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 440px;
    padding: 3rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.auth-logo span {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    margin-right: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

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

.btn-full {
    width: 100%;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: var(--bg-color);
}

.auth-links {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

/* Modern Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-color);
}

.sidebar {
    width: 160px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 1rem 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    min-height: 70px;
}

.sidebar-logo {
    max-height: 40px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-item:hover, .nav-item.active {
    background: #e0e7ff;
    color: var(--primary);
    font-weight: 600;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.top-nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
}

.icon-link {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0.5rem;
    border-radius: 6px;
}

.icon-link:hover {
    color: var(--primary);
    background: var(--bg-color);
}

.icon-link.text-danger:hover {
    background: #fee2e2;
}

.notification-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    padding: 0.1rem 0.4rem;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--card-bg);
}

.main-content {
    max-width: 1800px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Supplies List */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

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

.supply-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.supply-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: #fee2e2;
    color: #991b1b;
}

.badge-complete {
    background: #e0e7ff;
    color: var(--primary);
}

.photo-gallery {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.photo-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: zoom-in;
    flex-shrink: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none; border: none;
    font-size: 1.5rem; cursor: pointer;
    color: var(--text-muted);
}

/* Image Viewer Modal */
.img-viewer-overlay {
    background: rgba(0,0,0,0.9);
}
.img-viewer-content {
    background: transparent;
    max-width: 95vw;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: none;
}
.img-viewer-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    transition: transform 0.1s;
    cursor: grab;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.supply-table {
    width: 100%;
    border-collapse: collapse;
}

.supply-table th {
    background: var(--bg-color);
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.supply-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
}

.supply-table .table-row {
    transition: background-color 0.2s;
    cursor: pointer;
}

.supply-table .table-row:hover {
    background-color: #f8fafc;
}

.photo-thumb-sm {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: zoom-in;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.photo-thumb-sm:hover {
    transform: scale(1.1);
}

.truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Drag & Drop Upload */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-color);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
}
.preview-list {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.preview-item {
    position: relative;
    width: 80px; height: 80px;
}
.preview-item img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 8px;
}
.preview-item button {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--danger);
    color: white; border: none;
    border-radius: 50%; width: 20px; height: 20px;
    cursor: pointer; font-size: 12px;
}

/* Flashes */
.flash-messages {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}
.flash {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    color: white;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease-out;
}
.flash-danger { background: var(--danger); }
.flash-success { background: var(--success); }
.flash-warning { background: var(--warning); color: #000; }

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-bar .input-group {
    display: flex;
    align-items: center;
    height: 36px;
}

.filter-bar .input-group-text {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.8rem;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    box-sizing: border-box;
}

.filter-bar .form-control {
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
    height: 100%;
    padding: 0 0.5rem;
    margin: 0;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.filter-bar select.form-control {
    border-radius: 4px;
    width: auto;
    min-width: 110px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 0.5rem;
}

.filter-bar .search-wrapper {
    flex-grow: 1;
    height: 36px;
}

.filter-bar .search-wrapper input {
    border-radius: 4px;
    width: 100%;
    height: 100%;
}

.filter-bar .btn {
    height: 36px;
    padding: 0 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-icon {
    width: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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