/* ========================================
   Disponibilidade Fotografia PIB Curitiba
   Styles — shared by index.html & admin.html
   ======================================== */

/* CSS Variables */
:root {
    --primary-color: #6B46C1;
    --primary-dark: #553C9A;
    --primary-light: #805AD5;
    --primary-lighter: #E9D8FD;
    --secondary-color: #38A169;
    --secondary-light: #C6F6D5;
    --error-color: #E53E3E;
    --error-light: #FED7D7;
    --warning-color: #DD6B20;
    --warning-light: #FEEBC8;
    --info-color: #3182CE;
    --info-light: #BEE3F8;
    --background: #F7FAFC;
    --surface: #FFFFFF;
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 540px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 20px 0 24px;
}

.header h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header .subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 4px;
}

/* Card */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: slideUp 0.3s ease;
    margin-bottom: 16px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Message Header */
.message-header {
    background: var(--primary-lighter);
    border-left: 4px solid var(--primary-color);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-line;
}

/* Countdown */
.countdown-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--info-light);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--info-color);
    font-weight: 500;
}

.countdown-bar.urgent {
    background: var(--warning-light);
    color: var(--warning-color);
}

.countdown-bar.expired {
    background: var(--error-light);
    color: var(--error-color);
}

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

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

select, textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234A5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
    cursor: pointer;
}

select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.15);
}

textarea {
    resize: vertical;
    min-height: 70px;
}

/* Week sections */
.week-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
}

.week-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.week-header:hover {
    background: var(--border-color);
}

.week-header .chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.week-header.collapsed .chevron {
    transform: rotate(-90deg);
}

.week-badge {
    background: var(--primary-lighter);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.week-body {
    padding: 8px 12px;
}

.week-body.hidden {
    display: none;
}

/* Service checkbox items */
.service-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

.service-item:hover {
    background: var(--background);
}

.service-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.service-info {
    flex: 1;
    min-width: 0;
}

.service-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.service-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Searchable volunteer select */
.search-select {
    position: relative;
}

.search-select input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-select input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.15);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.search-dropdown[hidden] {
    display: none;
}

.search-option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.search-option:hover,
.search-option.highlighted {
    background: var(--primary-lighter);
    color: var(--primary-dark);
}

.search-hint {
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.selected-volunteer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--primary-lighter);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.selected-volunteer[hidden] {
    display: none;
}

.clear-selection {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--primary-color);
    line-height: 1;
    padding: 0 4px;
}

.clear-selection:hover {
    color: var(--error-color);
}

/* "Não posso" per week */
.cant-week-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 6px;
    font-size: 0.85rem;
    color: var(--error-color);
    font-weight: 600;
    cursor: pointer;
}

.cant-week-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--error-color);
    cursor: pointer;
}

.week-body.week-disabled .service-item {
    opacity: 0.35;
    pointer-events: none;
}

.week-body.week-disabled .select-all-row {
    opacity: 0.35;
    pointer-events: none;
}

/* Select all per week */
.select-all-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
}

.select-all-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Selection summary */
.selection-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    font-size: 0.875rem;
}

.selection-count {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.selection-label {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 70, 193, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status / closed message */
.closed-card {
    text-align: center;
    padding: 40px 24px;
}

.closed-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.closed-card h2 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.closed-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Success card */
.success-card {
    text-align: center;
    padding: 32px 24px;
}

.success-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.success-card h2 {
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.success-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.success-summary {
    background: var(--background);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.success-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.success-summary .summary-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.summary-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Re-edit button */
.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    margin-top: 12px;
}

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

/* Loading */
.loading-card {
    text-align: center;
    padding: 48px 24px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* Pre-populate notice */
.prepopulate-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--secondary-light);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: #276749;
    margin-bottom: 16px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 540px) {
    .container {
        padding: 12px;
    }
    .card {
        padding: 18px;
    }
    .header h1 {
        font-size: 1.3rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1A202C;
        --surface: #2D3748;
        --text-primary: #F7FAFC;
        --text-secondary: #CBD5E0;
        --text-muted: #A0AEC0;
        --border-color: #4A5568;
        --primary-lighter: #44337A;
        --secondary-light: #22543D;
        --error-light: #742A2A;
        --warning-light: #7B341E;
        --info-light: #2A4365;
    }
    body {
        background: linear-gradient(135deg, #2D3748 0%, #1A202C 100%);
    }
    select, textarea, .search-select input[type="text"] {
        background: #1A202C;
    }
    .search-dropdown {
        background: #2D3748;
    }
    .selected-volunteer {
        background: #44337A;
        color: #D6BCFA;
    }
    .week-badge {
        color: #D6BCFA;
    }
    .prepopulate-notice {
        color: #9AE6B4;
    }
}
