/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Adjusted gradient proportions to make the middle white part thicker */
    background: linear-gradient(90deg, #fa3737 0%, #fae7e7 50%, #fa3737 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Header Card */
.header-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    max-width: 1160px; /* Match container max-width minus padding */
}

.header-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.header-card h1 {
    color: #333;
    text-shadow: none;
    margin-bottom: 10px;
}

.header-card p {
    color: #666;
    opacity: 1;
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card.primary .stat-icon {
    background: linear-gradient(135deg, #FF0000, #CC0000);
}

.stat-card.secondary .stat-icon {
    background: linear-gradient(135deg, #FF0000, #AA0000);
}

.stat-card.accent .stat-icon {
    background: linear-gradient(135deg, #CC0000, #FF0000);
}

.stat-card.info .stat-icon {
    background: linear-gradient(135deg, #AA0000, #FF0000);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #FF6666, #FF0000);
}

.stat-content h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-subtitle {
    font-size: 0.8rem;
    color: #999;
}

/* Progress Section */
.progress-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.progress-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.progress-bar {
    position: relative;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF0000, #CC0000);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #333;
    font-size: 0.9rem;
}

/* Countdown Section */
.countdown-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.countdown-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.countdown {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-number {
    font-size: 3rem;
    font-weight: bold;
    color: #FF0000;
    line-height: 1;
}

.countdown-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

/* Navigation Tabs */
.tabs {
    display: flex;
    background: white;
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    gap: 10px;
    flex-wrap: wrap;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.tab-button:hover {
    background: #f8f9fa;
    color: #333;
}

.tab-button.active {
    background: linear-gradient(135deg, #FF0000, #CC0000);
    color: white;
}

/* Content Sections */
.content-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h2 {
    color: #333;
    flex: 1;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #FF0000, #CC0000);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.8rem;
}

/* Settings Form */
.settings-form {
    max-width: 500px;
}

/* Data Actions */
.data-actions {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.action-card {
    padding: 25px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-align: center;
}

.action-card.danger {
    border-color: #dc3545;
    background: #fff5f5;
}

/* Cloud Sync Card */
.action-card.cloud-sync {
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.action-card.cloud-sync h3 {
    color: #0056b3;
}



/* Share Progress Card */
.action-card.share-progress {
    border-color: #28a745;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
}

.action-card.share-progress h3 {
    color: #1e7e34;
}

.action-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.action-card p {
    margin-bottom: 20px;
    color: #666;
}

/* Trips List */
.trips-list {
    min-height: 200px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #333;
}

.trip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.trip-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.trip-info {
    flex: 1;
}

.trip-dates {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.trip-details {
    color: #666;
    font-size: 0.9rem;
}

.trip-duration {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #667eea;
    margin: 0 15px;
}

.trip-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #333;
}

.modal form {
    padding: 30px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.overlay.active {
    display: block;
}

/* Calculation Explanation */
.calculation-explanation {
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.calculation-explanation h3 {
    text-align: center;
    color: #FF0000;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.explanation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.explanation-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #FF0000;
}

.explanation-card h4 {
    color: #FF0000;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.explanation-card p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.disclaimer {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.disclaimer p {
    margin: 0;
    color: #856404;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .countdown {
        gap: 20px;
    }
    
    .countdown-number {
        font-size: 2rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        min-width: auto;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .data-actions {
        grid-template-columns: 1fr;
    }
    
    .trip-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .trip-duration {
        margin: 0;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal form {
        padding: 20px;
    }
    
    .modal-header {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .countdown {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .countdown-number {
        font-size: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* Firebase Authentication & Cloud Sync Styles */

/* Header Layout */
.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.header-title {
    /* Title is now inside header-card, no flex properties needed */
}

.header-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

/* Authentication Section */
.auth-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
}

.sync-status.sync-success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.sync-status.sync-progress {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.sync-status.sync-error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.sync-status.sync-offline {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.1);
}

.sync-status.sync-queued {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.user-details {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Authentication Modal */
.auth-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-divider {
    text-align: center;
    position: relative;
    margin: 10px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider span {
    background: white;
    padding: 0 15px;
    color: #6b7280;
    font-size: 0.9rem;
}

.email-auth {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-note {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    margin-top: -5px;
}

/* Share Modal */
.share-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.share-link-container {
    display: flex;
    gap: 10px;
}

.share-link-container input {
    flex: 1;
}

.share-preview {
    background: #f9fafb;
    border-radius: 8px;
    padding: 15px;
}

.share-preview h4 {
    margin-bottom: 10px;
    color: #374151;
    font-size: 0.9rem;
}

.preview-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e5e7eb;
}

.preview-card h5 {
    margin-bottom: 10px;
    color: #1f2937;
}

.preview-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #6b7280;
}

.preview-stat strong {
    color: #1f2937;
}

.share-note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.85rem;
    color: #1e40af;
}

.share-note i {
    margin-right: 5px;
}

/* Data Conflict Modal */
.conflict-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.conflict-options .btn {
    justify-content: flex-start;
    gap: 10px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 350px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid #10b981;
    color: #065f46;
}

.toast-success i {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.toast-error i {
    color: #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.toast-info i {
    color: #3b82f6;
}

/* Responsive Design for New Elements */
@media (max-width: 768px) {
    .header-content {
        text-align: center;
    }
    
    .header-title {
        min-width: auto;
    }
    
    .user-info {
        align-items: flex-end;
    }
    
    .user-details {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .share-link-container {
        flex-direction: column;
    }
    
    .preview-stats {
        gap: 12px;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}