/* A4d-planner 2.0 - Main Stylesheet */
/* Based on HarvestApp design principles */

/* Reset and base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

/* Container and layout */
.a4d-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 16px 0;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
    color: #1a1a1a;
}

h2 {
    font-size: 1.5rem;
    color: #333;
}

h3 {
    font-size: 1.25rem;
    color: #444;
}

p {
    margin: 0 0 16px 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.btn-primary {
    background-color: #007cba;
    color: white;
}

.btn-primary:hover {
    background-color: #005a87;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.form-group input:disabled,
.form-group select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Volunteer Dashboard */
.a4d-volunteer-dashboard {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.dashboard-header h1 {
    color: #007cba;
    margin-bottom: 10px;
}

.form-note {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.form-note p {
    margin: 0;
    color: #0066cc;
    font-size: 14px;
}

.availability-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.availability-table {
    min-width: 600px;
}

.availability-table th,
.availability-table td {
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
}

.availability-table .day-cell {
    text-align: left;
    font-weight: 500;
    min-width: 80px;
}

.availability-table .role-type-cell select,
.availability-table .route-select {
    min-width: 120px;
    font-size: 13px;
}

.availability-table .no-route {
    color: #6c757d;
    font-style: italic;
    font-size: 12px;
}

.availability-table tr.locked {
    background-color: #f8f9fa;
    opacity: 0.7;
}

.availability-table tr.locked select {
    background-color: #f8f9fa;
    color: #6c757d;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
}

.save-status {
    font-size: 14px;
    font-weight: 500;
}

.save-status.success {
    color: #28a745;
}

.save-status.error {
    color: #dc3545;
}

/* Organizer Dashboard */
.a4d-organizer-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #e9ecef;
}

.tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-button.active,
.tab-button:hover {
    color: #007cba;
    border-bottom-color: #007cba;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.capacity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.day-column {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.day-column h3 {
    margin: 0 0 10px 0;
    color: #007cba;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.date {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 20px;
}

.route-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.route-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.route-time {
    background: #007cba;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.capacity-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.capacity-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-label {
    min-width: 120px;
    font-size: 13px;
    color: #495057;
}

.capacity-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
}

.capacity-text {
    min-width: 60px;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
}

.route-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

/* Volunteers table */
.volunteers-table-container {
    overflow-x: auto;
}

.volunteers-table {
    min-width: 800px;
}

.volunteers-table th,
.volunteers-table td {
    padding: 10px 8px;
    font-size: 13px;
}

.no-availability {
    color: #6c757d;
    font-style: italic;
}

/* Routes management */
.routes-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.day-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.day-section h3 {
    margin: 0 0 15px 0;
    color: #007cba;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.route-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
}

.route-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}

.route-info p {
    margin: 0;
    font-size: 12px;
    color: #6c757d;
}

.route-capacities {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #495057;
}

.route-capacities span {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.route-actions {
    display: flex;
    gap: 8px;
}

/* Settings */
.settings-form {
    max-width: 500px;
}

/* Messages */
.message {
    padding: 10px 15px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 14px;
}

.message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.message.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Authentication forms */
.a4d-login-form,
.a4d-registration-form,
.a4d-totp-setup {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.a4d-login-form h2,
.a4d-registration-form h2,
.a4d-totp-setup h2 {
    text-align: center;
    color: #007cba;
    margin-bottom: 20px;
}

.qr-code {
    text-align: center;
    margin: 20px 0;
}

.qr-code img {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.manual-secret {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.manual-secret code {
    font-size: 16px;
    font-weight: bold;
    color: #007cba;
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .a4d-container,
    .a4d-volunteer-dashboard,
    .a4d-organizer-dashboard {
        padding: 15px;
    }
    
    .dashboard-tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1;
        min-width: 120px;
    }
    
    .capacity-grid {
        grid-template-columns: 1fr;
    }
    
    .route-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .route-capacities {
        flex-wrap: wrap;
    }
    
    .availability-table {
        font-size: 12px;
    }
    
    .availability-table th,
    .availability-table td {
        padding: 8px 4px;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .availability-table th,
    .availability-table td {
        padding: 6px 2px;
        font-size: 11px;
    }
    
    .availability-table .role-type-cell select,
    .availability-table .route-select {
        min-width: 100px;
        font-size: 11px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .btn,
    .route-actions,
    .form-actions {
        display: none;
    }
    
    .a4d-container,
    .a4d-volunteer-dashboard,
    .a4d-organizer-dashboard {
        padding: 0;
    }
    
    table {
        box-shadow: none;
    }
}
