/* ===================================
   Google Calendar Clone - Styles
   =================================== */

/* CSS Variables */
:root {
    --google-blue: #1a73e8;
    --google-blue-hover: #1765cc;
    --google-red: #d93025;
    --google-yellow: #f9ab00;
    --google-green: #188038;

    --text-primary: #3c4043;
    --text-secondary: #5f6368;
    --text-disabled: #80868b;

    --bg-primary: #ffffff;
    --bg-secondary: #f1f3f4;
    --bg-hover: #f8f9fa;

    --border-color: #dadce0;
    --border-light: #e8eaed;

    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-md: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);

    --header-height: 64px;
    --time-col-width: 56px;
    --hour-height: 48px;
}

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

body {
    font-family: 'Google Sans', 'Roboto', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ===================================
   Authentication Overlay
   =================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-modal {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 48px;
    width: 100%;
    max-width: 450px;
    margin: 20px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.calendar-icon {
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 400;
    color: var(--text-primary);
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

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

.btn-auth {
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: var(--google-blue);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-auth:hover:not(:disabled) {
    background: var(--google-blue-hover);
    box-shadow: var(--shadow-sm);
}

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

.error-message {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fce8e6;
    border: 1px solid var(--google-red);
    border-radius: 4px;
    color: var(--google-red);
    font-size: 14px;
}

/* ===================================
   Calendar App Layout
   =================================== */
.calendar-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.calendar-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left {
    min-width: 220px;
}

.header-center {
    flex: 1;
    justify-content: center;
}

.header-right {
    min-width: 220px;
    justify-content: flex-end;
}

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

.menu-btn:hover,
.icon-btn:hover {
    background: var(--bg-hover);
}

.header-logo {
    flex-shrink: 0;
}

.header-title {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-secondary);
}

.nav-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-hover);
}

.current-date {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
    min-width: 200px;
    text-align: center;
}

.view-selector {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.view-selector:focus {
    outline: none;
    border-color: var(--google-blue);
}

/* ===================================
   Calendar Main Area
   =================================== */
.calendar-main {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--google-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Error Banner */
.error-banner {
    padding: 16px;
    background: #fce8e6;
    border-bottom: 1px solid var(--google-red);
    color: var(--google-red);
    font-size: 14px;
    text-align: center;
}

/* ===================================
   Week View
   =================================== */
.week-view {
    height: 100%;
    display: flex;
    overflow: hidden;
}

/* Time Column */
.time-column {
    width: var(--time-col-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    left: 0;
    z-index: 20;
    overflow-x: hidden;
    overflow-y: clip;
}

.time-gutter {
    height: 48px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 30;
}

.time-labels {
    position: relative;
    background: var(--bg-primary);
}

.time-label {
    height: var(--hour-height);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 4px;
    position: relative;
}

.time-label::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 1px;
    background: var(--border-light);
}

/* Days Grid */
.days-grid {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: auto;
}

.day-column {
    flex: 1;
    min-width: 120px;
    border-right: 1px solid var(--border-light);
    position: relative;
}

.day-column:last-child {
    border-right: none;
}

.day-header {
    height: 48px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

.day-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.day-number {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 400;
    margin-top: 2px;
}

.day-header.today .day-number {
    background: var(--google-blue);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-content {
    position: relative;
    height: calc(var(--hour-height) * 19); /* 5:00 to 24:00 = 19 hours */
}

/* Hour Lines */
.hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: var(--hour-height);
    border-top: 1px solid var(--border-light);
}

/* Events */
.calendar-event {
    position: absolute;
    left: 2px;
    right: 2px;
    background: var(--google-blue);
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: all 0.2s;
    word-wrap: break-word;
}

.calendar-event:hover {
    box-shadow: var(--shadow-sm);
    z-index: 50;
    transform: scale(1.02);
}

.event-time-text {
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
}

.event-title-text {
    font-weight: 400;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

/* Event Colors */
.calendar-event.event-color-1 { background: #039be5; }
.calendar-event.event-color-2 { background: #7986cb; }
.calendar-event.event-color-3 { background: #33b679; }
.calendar-event.event-color-4 { background: #f6bf26; }
.calendar-event.event-color-5 { background: #ff7043; }
.calendar-event.event-color-6 { background: #8e24aa; }
.calendar-event.event-color-7 { background: #d50000; }

/* All-day Events */
.all-day-events {
    min-height: 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    padding: 4px;
}

.all-day-event {
    background: var(--google-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 12px;
    margin: 2px 0;
    cursor: pointer;
}

/* No Events State */
.no-events-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-disabled);
}

.no-events-state p {
    margin-top: 16px;
    font-size: 16px;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    :root {
        --time-col-width: 42px;
        --hour-height: 60px;
        --header-height: 56px;
    }

    .header-left,
    .header-right {
        min-width: auto;
        gap: 8px;
    }

    .header-title {
        display: none;
    }

    .header-center {
        gap: 8px;
    }

    .current-date {
        font-size: 14px;
        min-width: auto;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .day-column {
        min-width: 60px;
        flex: 1;
    }

    .day-name {
        font-size: 10px;
    }

    .day-number {
        font-size: 16px;
    }

    .day-header.today .day-number {
        width: 32px;
        height: 32px;
    }

    .time-label {
        font-size: 10px;
        padding-top: 2px;
    }

    .calendar-event {
        padding: 2px 4px;
        font-size: 10px;
        border-radius: 2px;
    }

    .event-time-text {
        font-size: 9px;
        margin-bottom: 1px;
    }

    .event-title-text {
        font-size: 10px;
        line-height: 1.2;
    }

    .view-selector {
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    :root {
        --time-col-width: 38px;
        --header-height: 56px;
    }

    .calendar-header {
        padding: 0 8px;
    }

    .header-left,
    .header-right {
        gap: 4px;
    }

    .header-center {
        gap: 4px;
    }

    .current-date {
        font-size: 13px;
    }

    .nav-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .day-column {
        min-width: 50px;
    }

    .day-header {
        height: 40px;
    }

    .day-name {
        font-size: 9px;
    }

    .day-number {
        font-size: 14px;
    }

    .day-header.today .day-number {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .time-label {
        font-size: 9px;
    }

    .calendar-event {
        padding: 2px 3px;
        font-size: 9px;
    }

    .event-time-text {
        font-size: 8px;
    }

    .event-title-text {
        font-size: 9px;
    }

    .auth-modal {
        padding: 32px 24px;
    }

    .view-selector {
        padding: 4px 6px;
        font-size: 11px;
    }

    .header-logo {
        width: 28px;
        height: 28px;
    }
}

/* Spinner animation */
.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* ===================================
   Admin Page Styles
   =================================== */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.section {
    width: 100%;
    max-width: 600px;
}

.card {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 48px;
    margin: 20px 0;
}

.admin-card h1 {
    font-size: 32px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

/* Step Indicator */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 1;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: all 0.3s;
}

.step.active .step-number {
    background: var(--google-blue);
    color: white;
}

.step.completed .step-number {
    background: var(--google-green);
    color: white;
}

.step-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.step-line {
    width: 80px;
    height: 2px;
    background: var(--border-color);
    margin: 0 16px;
}

/* Status Boxes */
.status-box {
    text-align: center;
    padding: 24px 0;
}

.status-box h2 {
    font-size: 24px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.status-box p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.status-box.success h2 {
    color: var(--google-green);
}

.status-box.error h2 {
    color: var(--google-red);
}

.success-icon,
.error-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.spinner-large {
    font-size: 48px;
    margin-bottom: 16px;
    animation: spin 1s linear infinite;
}

/* Info Text */
.info-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 16px 0 8px 0;
}

.info-list {
    text-align: left;
    margin: 0 auto 24px auto;
    max-width: 400px;
    padding-left: 20px;
}

.info-list li {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 4px;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--google-blue-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-success:hover:not(:disabled) {
    background: #137333;
    box-shadow: var(--shadow-sm);
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
}

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

/* Next Steps */
.next-steps {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.next-steps h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.next-steps ol {
    padding-left: 20px;
}

.next-steps li {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 8px;
}

.next-steps a {
    color: var(--google-blue);
    text-decoration: none;
}

.next-steps a:hover {
    text-decoration: underline;
}

/* Warning Box */
.warning-box {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 16px;
    margin-top: 24px;
    text-align: left;
}

.warning-box strong {
    color: #856404;
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.warning-box p {
    color: #856404;
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.footer p {
    margin: 0;
}

/* Admin Page Responsive */
@media (max-width: 768px) {
    .card {
        padding: 32px 24px;
    }

    .admin-card h1 {
        font-size: 26px;
    }

    .subtitle {
        font-size: 14px;
    }

    .status-box h2 {
        font-size: 20px;
    }

    .step-line {
        width: 60px;
        margin: 0 12px;
    }

    .btn-large {
        padding: 12px 24px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 24px 16px;
    }

    .admin-card h1 {
        font-size: 22px;
    }

    .subtitle {
        font-size: 13px;
        margin-bottom: 24px;
    }

    .status-box h2 {
        font-size: 18px;
    }

    .step-line {
        width: 40px;
        margin: 0 8px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .step-text {
        font-size: 11px;
    }

    .info-list {
        font-size: 13px;
    }

    .btn-large {
        padding: 10px 20px;
        font-size: 13px;
    }

    .success-icon,
    .error-icon {
        font-size: 48px;
    }

    .spinner-large {
        font-size: 36px;
    }
}
