/* -----------------------------------------------------------
   THEMING & VARIABLES
----------------------------------------------------------- */
:root {
    /* Light Mode (Default) */
    --primary: #1a73e8; /* Google Blue */
    --primary-hover: #1557b0;
    --accent: #34a853; /* Google Green */
    --bg-app: #f0f2f5;
    --bg-surface: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-hover:
        0 4px 6px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.12);
    --danger: #d93025;
    --warning: #fbbc04;
    --input-bg: #ffffff;
    --radius: 12px;
}

[data-theme="dark"] {
    --primary: #8ab4f8;
    --primary-hover: #aecbfa;
    --accent: #81c995;
    --bg-app: #202124;
    --bg-surface: #2d2e31;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --border: #5f6368;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.6);
    --danger: #f28b82;
    --warning: #fdd663;
    --input-bg: #3c4043;
}

/* -----------------------------------------------------------
   GLOBAL RESET & TYPOGRAPHY
----------------------------------------------------------- */
body {
    font-family:
        "Roboto",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 500;
}
.hidden {
    display: none !important;
}
.divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* -----------------------------------------------------------
   LAYOUT
----------------------------------------------------------- */
.app-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
}

/* Main Grid (Top Row) */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Equal split or 1.2fr 1fr */
    gap: 24px;
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
}

/* -----------------------------------------------------------
   CARDS
----------------------------------------------------------- */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition:
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}

.card h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

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

.centered-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.centered-header h2 {
    font-size: 1.4rem;
    color: var(--primary);
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

/* -----------------------------------------------------------
   INPUTS & AVAILABILITY
----------------------------------------------------------- */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

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

label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

input,
select {
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Availability Grid */
.avail-grid {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.day-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.day-input label {
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.avail-input {
    width: 100%;
    text-align: center;
    padding: 8px 4px;
    border-radius: 6px;
}

/* -----------------------------------------------------------
   BUTTONS
----------------------------------------------------------- */
.btn {
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn {
    background-color: var(--primary);
    color: #fff;
}
.primary-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.accent-btn {
    background-color: var(--accent);
    color: #fff;
}
.accent-btn:hover {
    filter: brightness(1.1);
}

.text-btn {
    background: transparent;
    color: var(--text-secondary);
}
.text-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.debug-area {
    margin-top: -10px; 
    margin-bottom: 10px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
    color: var(--text-primary);
}

.full-width {
    width: 100%;
}
.small {
    font-size: 0.8rem;
    padding: 4px 12px;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}
.actions-area {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* -----------------------------------------------------------
   TASK LIST
----------------------------------------------------------- */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    border: 2px dashed var(--border);
    border-radius: 8px;
}

.task-item {
    background-color: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-info h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
}
.task-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}
.task-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--border);
    font-size: 0.75rem;
}
.task-tag.heavy {
    background-color: rgba(217, 48, 37, 0.1);
    color: var(--danger);
}
.task-tag.light {
    background-color: rgba(52, 168, 83, 0.1);
    color: var(--accent);
}

.action-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-secondary);
}
.action-btn.edit:hover {
    color: var(--primary);
}
.action-btn.delete:hover {
    color: var(--danger);
}

/* -----------------------------------------------------------
   SCHEDULE RESULT
----------------------------------------------------------- */
.schedule-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.summary-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    background-color: var(--bg-app);
    border-radius: 8px;
    border: 1px solid var(--border);
    justify-content: center;
}

.stat-item {
    text-align: center;
    min-width: 120px;
}
.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}
.stat-value.ok {
    color: var(--accent);
}
.stat-value.warn {
    color: var(--warning);
}
.stat-value.danger {
    color: var(--danger);
}

.schedule-day {
    border-left: 3px solid var(--primary);
    padding-left: 20px;
    margin-left: 10px;
    margin-bottom: 24px;
}

.day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.day-header h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
}
.day-avail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-app);
    padding: 4px 8px;
    border-radius: 4px;
}

.schedule-item {
    background-color: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.note-text {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-secondary);
}
.section-title {
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 30px 0 16px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.status-msg {
    margin-top: 10px;
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.2em;
    color: var(--text-secondary);
}

.priority-badge {
    color: var(--primary);
    font-weight: 500;
}