@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

:root {
    --dark-bg: #111827;
    --light-dark-bg: #1F2937;
    --border-color: #374151;
    --text-light: #F3F4F6;
    --text-muted: #9CA3AF;
    --accent-blue: #60A5FA;
    --accent-red: #F87171;
}

body { font-family: 'Montserrat', sans-serif; margin: 0; background-color: var(--dark-bg); color: var(--text-light); display: flex; height: 100vh; overflow: hidden; }
.page { display: none; width: 100%; height: 100%; }
.page.active { display: flex; }

#login-page { justify-content: center; align-items: center; }
.login-box { background-color: var(--light-dark-bg); padding: 40px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); text-align: center; width: 350px; }
.login-box h2 { font-size: 24px; margin-bottom: 5px; }
.login-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 30px; }
.input-group { position: relative; margin-bottom: 25px; }
.input-group input { width: 100%; padding: 10px 0; background: none; border: none; border-bottom: 2px solid #4B5563; color: var(--text-light); font-size: 16px; outline: none; }
.input-group label { position: absolute; top: 10px; left: 0; color: var(--text-muted); font-size: 16px; pointer-events: none; transition: 0.3s; }
.input-group input:focus + label, .input-group input:valid + label { top: -15px; font-size: 12px; color: var(--accent-blue); }
.login-button { width: 100%; padding: 12px; background: linear-gradient(to right, #3B82F6, var(--accent-blue)); border: none; border-radius: 8px; color: white; font-weight: 600; font-size: 16px; cursor: pointer; transition: box-shadow 0.3s; }
.login-button:hover { box-shadow: 0 5px 15px rgba(96, 165, 250, 0.4); }
.error-message { color: var(--accent-red); font-size: 12px; margin-top: 15px; height: 15px; }

.sidebar { width: 250px; background-color: var(--light-dark-bg); display: flex; flex-direction: column; border-right: 1px solid var(--border-color); flex-shrink: 0; }
.sidebar-header { padding: 20px; text-align: center; border-bottom: 1px solid var(--border-color); }
.sidebar-header h3 { margin: 0; font-size: 20px; }
.sidebar-menu { list-style: none; padding: 20px 0; margin: 0; }
.sidebar-menu li a { display: flex; align-items: center; gap: 15px; padding: 15px 20px; color: #D1D5DB; text-decoration: none; font-weight: 600; transition: all 0.2s; }
.sidebar-menu li.active a, .sidebar-menu li a:hover { background-color: var(--border-color); color: #FFFFFF; border-left: 3px solid var(--accent-blue); padding-left: 17px; }
.sidebar-menu li a i { width: 20px; text-align: center; }

.main-content { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }
header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
header h2 { margin: 0; font-size: 28px; }
header div { display: flex; gap: 15px; }

.action-button { background: linear-gradient(to right, #3B82F6, var(--accent-blue)); color: white; border: none; border-radius: 8px; padding: 10px 15px; font-weight: 600; cursor: pointer; transition: box-shadow 0.3s; }
.action-button.secondary { background: var(--border-color); }
.delete-btn { background: none; border: none; color: var(--accent-red); cursor: pointer; padding: 5px; font-size: 16px; }

.content-page { display: none; flex-grow: 1; flex-direction: column; overflow: hidden; }
.content-page.active { display: flex; }

.card-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; padding: 20px; }
.card { background-color: var(--light-dark-bg); padding: 20px; border-radius: 8px; }
.card h4 { margin: 0 0 10px 0; font-size: 14px; color: var(--text-muted); }
.card p { margin: 0; font-size: 28px; font-weight: 700; }

.chart-container { flex-grow: 1; padding: 20px; min-height: 200px; }

.table-container { padding: 20px; overflow-y: auto; flex-grow: 1; }
table { width: 100%; border-collapse: collapse; }
thead th { background-color: var(--border-color); padding: 12px 15px; text-align: left; font-size: 12px; text-transform: uppercase; }
tbody td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

.status-used { color: var(--accent-red); font-weight: 600; }
.status-available { color: #34D399; font-weight: 600; }

.settings-form-container { padding: 20px; max-width: 800px; margin: 0 auto; }
#settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.settings-form-container h3 { margin-top: 20px; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; grid-column: 1 / -1; }
.settings-form-container .action-button { margin-top: 20px; grid-column: 1 / -1; justify-self: center; width: 50%; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--light-dark-bg); padding: 30px; border-radius: 12px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 15px; margin-top: 30px; }
.modal-button { padding: 10px 20px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.modal-button.primary { background: linear-gradient(to right, #3B82F6, var(--accent-blue)); color: white; }
.modal-button.secondary { background: var(--border-color); color: var(--text-light); }

@media (max-width: 768px) {
    body { overflow: auto; }
    #app-page { flex-direction: column; height: auto; }
    .sidebar { width: 100%; height: auto; flex-direction: row; padding: 0 5px; box-sizing: border-box; }
    .sidebar-header { display: none; } 
    .sidebar-menu { display: flex; flex-grow: 1; justify-content: space-around; padding: 0; }
    
    .sidebar-menu li a span { display: none; } 
    .sidebar-menu li a i { width: auto; font-size: 20px; margin: 0; }
    .sidebar-menu li a { padding: 15px; justify-content: center; border-left: none !important; }
    .sidebar-menu li.active a { background-color: transparent; border-bottom: 3px solid var(--accent-blue); color: var(--accent-blue); }

    .main-content { overflow: visible; }
    header { padding: 15px; flex-direction: column; align-items: flex-start; gap: 10px; }
    header h2 { font-size: 20px; }

    .card-container { grid-template-columns: 1fr; padding: 15px; gap: 15px; }
    .card p { font-size: 24px; }
    
    #settings-form { grid-template-columns: 1fr; }
    .settings-form-container .action-button { width: 100%; }
    .table-container { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }
    tbody td, thead th { padding: 10px; font-size: 13px; }

    .settings-form-container { padding: 15px; }
}
