/* CSS Variables for theming */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --success-hover: #059669;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;

    /* Working hours highlighting */
    --working-hours-bg: #dcfce7;
    --outside-hours-bg: #fef3c7;
    --late-night-bg: #fee2e2;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Section Styles */
.section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-hover);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.375rem;
    min-width: 32px;
    height: 32px;
}

/* Input Styles */
input[type="text"],
input[type="date"],
input[type="time"],
select {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--text-primary);
    transition: var(--transition);
    width: 100%;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Time Zone Section */
.timezone-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.timezone-select {
    flex: 1;
}

.selected-timezones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timezone-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.timezone-tag .remove-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: var(--transition);
}

.timezone-tag .remove-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Time Input Section */
.time-input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.input-row label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.time-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.time-slot-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.time-slot-datetime {
    font-weight: 500;
    color: var(--text-primary);
}

.time-slot-timezone {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Comparison Table */
.comparison-container {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.comparison-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.comparison-table tr:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

/* Time cell highlighting */
.time-cell {
    font-weight: 500;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.time-cell.working-hours {
    background-color: var(--working-hours-bg);
    color: #166534;
}

.time-cell.outside-hours {
    background-color: var(--outside-hours-bg);
    color: #92400e;
}

.time-cell.late-night {
    background-color: var(--late-night-bg);
    color: #991b1b;
}

.overlap-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.overlap-good {
    background-color: var(--success-color);
}

.overlap-fair {
    background-color: #f59e0b;
}

.overlap-poor {
    background-color: var(--danger-color);
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
}

.legend-color.working {
    background-color: var(--working-hours-bg);
}

.legend-color.outside {
    background-color: var(--outside-hours-bg);
}

.legend-color.late {
    background-color: var(--late-night-bg);
}

/* Differences Section */
.differences-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.difference-card {
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.difference-card h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.difference-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.difference-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Save Section */
.save-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meeting-title-input {
    font-size: 1rem;
}

.save-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.saved-plans {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.saved-plans h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.plans-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.plan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.plan-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    cursor: pointer;
}

.plan-title {
    font-weight: 500;
    color: var(--text-primary);
}

.plan-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.plan-actions {
    display: flex;
    gap: 0.5rem;
}

.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Footer Styles */
.footer {
    background-color: var(--text-primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 0.875rem;
}

.footer a {
    color: #a5b4fc;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--text-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .timezone-input-group {
        flex-direction: column;
    }

    .time-input-group {
        grid-template-columns: 1fr;
    }

    .time-slot {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .comparison-table {
        font-size: 0.75rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
    }

    .save-buttons {
        flex-direction: column;
    }

    .save-buttons .btn {
        width: 100%;
    }

    .plan-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .plan-actions {
        width: 100%;
    }

    .plan-actions .btn {
        flex: 1;
    }

    .legend {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 1rem;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .main-content {
        padding: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timezone-tag,
.time-slot,
.plan-item {
    animation: fadeIn 0.2s ease;
}

/* Print Styles */
@media print {
    .header {
        background: none;
        color: var(--text-primary);
        padding: 1rem;
    }

    .btn {
        display: none;
    }

    .section {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    .footer {
        background: none;
        color: var(--text-primary);
    }

    .footer a {
        color: var(--primary-color);
    }
}
