/* Reset & Base */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.5;
}
a { color: #005f9e; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
    background: #005f9e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
}
.nav-brand { font-weight: 700; font-size: 1.2rem; }
.nav-menu {
    list-style: none;
    display: flex;
    gap: 18px;
    margin: 0;
    padding: 0;
}
.nav-menu a {
    color: rgba(255,255,255,0.9);
    padding: 6px 10px;
    border-radius: 6px;
}
.nav-menu a:hover, .nav-menu a.active {
    background: rgba(255,255,255,0.15);
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Auth box */
.auth-box {
    max-width: 420px;
    margin: 60px auto;
    background: #fff;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-box h2 { margin-top: 0; text-align: center; }
.auth-links {
    text-align: center;
    margin-top: 14px;
    font-size: 0.95rem;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccd6e0;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #005f9e;
    box-shadow: 0 0 0 3px rgba(0,95,158,0.15);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: #005f9e; color: #fff; }
.btn-primary:hover { background: #004a7c; }
.btn-secondary { background: #e2e8f0; color: #333; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #c64450; color: #fff; }
.btn-danger:hover { background: #a3323d; }
.btn-success { background: #70c353; color: #fff; }
.btn-success:hover { background: #5aa33f; }
.btn-block { width: 100%; }

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.alert-error { background: #ffe5e7; color: #8b1e2b; border: 1px solid #f5c2c7; }
.alert-success { background: #e6f4ea; color: #1e5e2f; border: 1px solid #b7dfc3; }
.alert-info { background: #e7f1ff; color: #0b3d6e; border: 1px solid #b9d4f5; }

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.calendar-months {
    text-align: center;
    margin-bottom: 10px;
}
.calendar-months a {
    display: inline-block;
    padding: 6px 10px;
    margin: 2px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #dbe3eb;
}
.calendar-months a:hover { background: #f0f4f8; }
.calendar-nav {
    text-align: center;
    margin-bottom: 14px;
    font-size: 1.1rem;
}
.calendar-nav a { padding: 6px 12px; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.calendar-grid .day-header {
    text-align: center;
    font-weight: 700;
    padding: 8px 0;
    background: #f0f4f8;
    border-radius: 6px;
}
.calendar-grid .day-cell {
    min-height: 70px;
    padding: 8px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e6ebf1;
    cursor: pointer;
    transition: transform .05s ease, box-shadow .15s ease;
    position: relative;
    overflow: hidden;
}
.calendar-grid .day-cell:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.18); z-index: 2; }
.day-cell.light-green:hover, .day-cell.green:hover, .day-cell.teal:hover,
.day-cell.blue:hover, .day-cell.purple:hover, .day-cell.brown:hover {
    filter: brightness(1.08);
}
.calendar-grid .day-cell.inactive {
    background: #f7f8fa;
    color: #9aa3ad;
    cursor: pointer;
}

/* Pale busy colors for inactive (prev/next month) days */
.calendar-grid .day-cell.inactive.light-green { background: #c8f5ef; color: #00695c; border: none; box-shadow: inset 0 0 0 2px rgba(0,105,92,0.15); }
.calendar-grid .day-cell.inactive.green { background: #dcedc8; color: #33691e; border: none; box-shadow: inset 0 0 0 2px rgba(51,105,30,0.15); }
.calendar-grid .day-cell.inactive.teal { background: #fff9c4; color: #f57f17; border: none; box-shadow: inset 0 0 0 2px rgba(245,127,23,0.15); }
.calendar-grid .day-cell.inactive.blue { background: #ffe0b2; color: #e65100; border: none; box-shadow: inset 0 0 0 2px rgba(230,81,0,0.15); }
.calendar-grid .day-cell.inactive.purple { background: #ffcdd2; color: #b71c1c; border: none; box-shadow: inset 0 0 0 2px rgba(183,28,28,0.15); }
.calendar-grid .day-cell.inactive.brown { background: #d7ccc8; color: #3e2723; border: none; box-shadow: inset 0 0 0 2px rgba(62,39,35,0.15); }

.calendar-grid .day-cell.inactive .busy-bar { background: rgba(0,0,0,0.12); }
.calendar-grid .day-cell.inactive .busy-bar::after { background: rgba(0,0,0,0.45); }
.calendar-grid .day-cell.today { border: 2px solid #29b6f6 !important; }
.calendar-grid .day-cell.selected { border: 2px solid #e53935 !important; box-shadow: none !important; }
.calendar-grid .day-cell.past-day { background: #f3f4f6; color: #888; }

/* Pale busy colors for past days in current month */
.calendar-grid .day-cell.past-day.light-green { background: #c8f5ef; color: #00695c; border: none; box-shadow: inset 0 0 0 2px rgba(0,105,92,0.15); }
.calendar-grid .day-cell.past-day.green { background: #dcedc8; color: #33691e; border: none; box-shadow: inset 0 0 0 2px rgba(51,105,30,0.15); }
.calendar-grid .day-cell.past-day.teal { background: #fff9c4; color: #f57f17; border: none; box-shadow: inset 0 0 0 2px rgba(245,127,23,0.15); }
.calendar-grid .day-cell.past-day.blue { background: #ffe0b2; color: #e65100; border: none; box-shadow: inset 0 0 0 2px rgba(230,81,0,0.15); }
.calendar-grid .day-cell.past-day.purple { background: #ffcdd2; color: #b71c1c; border: none; box-shadow: inset 0 0 0 2px rgba(183,28,28,0.15); }
.calendar-grid .day-cell.past-day.brown { background: #d7ccc8; color: #3e2723; border: none; box-shadow: inset 0 0 0 2px rgba(62,39,35,0.15); }

.calendar-grid .day-cell.past-day .busy-bar { background: rgba(0,0,0,0.12); }
.calendar-grid .day-cell.past-day .busy-bar::after { background: rgba(0,0,0,0.45); }

/* Busy colors - vivid */
.day-cell.light-green { background: linear-gradient(135deg, #00e5c9 0%, #00bfa5 100%); color: #fff; border: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); }
.day-cell.green { background: linear-gradient(135deg, #76ff03 0%, #64dd17 100%); color: #1b5e20; border: none; box-shadow: inset 0 0 0 2px rgba(27,94,32,0.25); }
.day-cell.teal { background: linear-gradient(135deg, #ffea00 0%, #ffc400 100%); color: #3e2723; border: none; box-shadow: inset 0 0 0 2px rgba(62,39,35,0.25); }
.day-cell.blue { background: linear-gradient(135deg, #ff9100 0%, #ff6d00 100%); color: #fff; border: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); }
.day-cell.purple { background: linear-gradient(135deg, #ff1744 0%, #d50000 100%); color: #fff; border: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); }
.day-cell.brown { background: linear-gradient(135deg, #5d4037 0%, #3e2723 100%); color: #fff; border: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); }

.day-cell .day-number { font-weight: 800; font-size: 1rem; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.day-cell .day-meta { font-size: 0.72rem; margin-top: 4px; font-weight: 600; opacity: 0.95; }

/* Busy indicator bar inside day cell */
.day-cell .busy-bar {
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    height: 5px;
    background: rgba(255,255,255,0.5);
    border-radius: 3px;
    overflow: hidden;
}
.day-cell .busy-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: rgba(255,255,255,0.95);
    border-radius: 3px;
}
.day-cell.light-green .busy-bar::after { width: 16%; }
.day-cell.green .busy-bar::after { width: 33%; }
.day-cell.teal .busy-bar::after { width: 50%; }
.day-cell.blue .busy-bar::after { width: 66%; }
.day-cell.purple .busy-bar::after { width: 83%; }
.day-cell.brown .busy-bar::after { width: 100%; }

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 14px 0;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.legend-box { width: 16px; height: 16px; border-radius: 4px; }

/* Records */
.records-date { margin: 24px 0 12px; font-size: 1.3rem; }
.record-card {
    background: #fff;
    border: 1px solid #dbe3eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.record-card { position: relative; }
.record-card .record-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 4.8rem;
    line-height: 1;
    opacity: 0.85;
}
.record-card h3 { margin: 0 0 8px; font-size: 1.1rem; padding-right: 90px; }
.record-card .badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-confirmed { background: #e6f4ea; color: #1e5e2f; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-type { background: #e7f1ff; color: #0b3d6e; }
.record-card p { margin: 4px 0; }
.record-actions { margin-top: 12px; display: flex; gap: 10px; }

.chain-block {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 14px 0 6px;
}
.chain-block h4 { margin: 0 0 8px; font-size: 0.95rem; color: #475569; }
.chain-summary { margin: 0 0 10px; font-size: 0.9rem; color: #334155; }
.chain-list { display: flex; flex-direction: column; gap: 6px; }
.chain-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #fff;
    border-radius: 6px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.chain-item.current { background: #e7f1ff; border: 1px solid #b9d4f5; }
.chain-icon { font-size: 1.2rem; }
.chain-time { color: #64748b; }
.chain-type { font-weight: 600; color: #1e293b; }
.chain-price { margin-left: auto; font-weight: 700; color: #005f9e; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    padding: 18px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    text-align: center;
}
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: #005f9e; }
.stat-card .label { color: #667; font-size: 0.95rem; margin-top: 4px; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    padding: 22px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* Utility */
.text-center { text-align: center; }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
