/* ============================================
   BASE STYLES
   CSS Variables, Reset, Typography, Layout
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #717171;
    --primary-hover: #8b8b8b;
    --secondary-color: #7c7c7c;
    --background: #121212;
    --surface: #282828;
    --surface-light: #3f3f3f;
    --text: #f1f5f9;
    --text-secondary: #b1b1b1;
    --border: #3f3f3f;
    --success: #47d5a6;
    --warning: #d7ac61;
    --danger: #d94a4a;
    --event-blue: #3b82f6;
    --event-purple: #a855f7;
    --event-green: #10b981;
    --event-orange: #f59e0b;
    --scrollbar: #9f9f9f;
    --scrollbar-hover: #d1d1d1;
    --hour-height-vertical: 42px;
}

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

/* Base Typography & Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    margin: 0 auto;
    padding: 0 1em;
    width: 100%;
}

.calendar-container-wrapper {
    margin: 0 auto;
    padding: 0 1em 1em 1em;
    width: 100%;
    margin-bottom: 50px; /* Space for fixed footer */
}

/* Header */
header {
    background: var(--surface);
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    z-index: 200;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-right: 60px; /* Space for hamburger button (30px width + 10px offset + 20px buffer) */
}

h1 {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    max-width: calc(100% - 70px); /* Prevent overlapping hamburger (60px space + 10px buffer) */
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

#timezone-display {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Button Styles */
.btn-primary, .btn-secondary, .btn-nav {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
}

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

.btn-nav {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

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

/* Global Scrollbar Styling */
@supports not selector(::-webkit-scrollbar) {
  html {
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar) var(--surface);
  }
}

body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body::-webkit-scrollbar-track {
    background: var(--surface);
}

body::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

body::-webkit-scrollbar-corner {
    background: var(--surface);
}

#calendar-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#calendar-container::-webkit-scrollbar-track {
    background: var(--surface);
}

#calendar-container::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 4px;
}

#calendar-container::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

#calendar-container::-webkit-scrollbar-corner {
    background: var(--surface);
}

/* ============================================
   MOBILE MENU STYLES
   Hamburger button, drawer, overlay
   ============================================ */

/* Hamburger Button */
.mobile-menu-toggle {
    display: flex; /* Always visible */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 201;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    transition: opacity 200ms ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Menu Drawer */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    background: var(--surface);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 200ms ease;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-width: 240px; /* Minimum width for usability (was 280px) */
    max-width: 75vh !important;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close:hover {
    color: var(--primary-color);
}

.mobile-menu-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-menu-content .btn-primary,
.mobile-menu-content .btn-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
}

.mobile-menu-theme {
    padding: 20px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-menu-theme #theme-selector {
    width: 100%;
}

.mobile-menu-bottom {
    padding: 20px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.mobile-menu-bottom .btn-primary,
.mobile-menu-bottom .btn-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
}

/* When signup and login buttons are both present, show them side by side */
.mobile-menu-bottom #signup-btn,
.mobile-menu-bottom #login-btn {
    flex: 1;
    min-width: 0;
}

/* When only logout button is present, it takes full width (default) */
.mobile-menu-bottom #logout-btn {
    width: 100%;
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Footer */
#app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 5px;
    text-align: center;
    z-index: 200;
}

#app-footer .footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

#app-footer #timezone-display {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

