/* A Dull Moment - Mobile-first PWA Styles */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --overlay-bg: rgba(0, 0, 0, 0.4);
    --btn-bg: rgba(255, 255, 255, 0.15);
    --btn-hover: rgba(255, 255, 255, 0.25);
    --modal-bg: #1f1f3a;
    --border-color: rgba(255, 255, 255, 0.1);
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.hidden {
    display: none !important;
}

/* =====================
   Display Mode Styles
   ===================== */

#display-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

#image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#display-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Overlay Controls */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay-btn {
    position: absolute;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--btn-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.overlay-btn:hover,
.overlay-btn:focus {
    background: var(--btn-hover);
    transform: scale(1.1);
    outline: none;
}

.overlay-btn:active {
    transform: scale(0.95);
}

.overlay-btn svg {
    width: 24px;
    height: 24px;
}

#btn-close {
    top: env(safe-area-inset-top, 16px);
    right: 16px;
    margin-top: 16px;
}

#btn-change-image {
    top: env(safe-area-inset-top, 16px);
    left: 16px;
    margin-top: 16px;
}

#btn-calendar {
    bottom: env(safe-area-inset-bottom, 16px);
    left: 16px;
    margin-bottom: 16px;
}

#btn-about {
    bottom: env(safe-area-inset-bottom, 16px);
    right: 16px;
    margin-bottom: 16px;
}

/* =====================
   Selection Mode Styles
   ===================== */

#selection-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.selection-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.selection-container h1 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.tagline {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 1rem;
}

#preview-container {
    width: 100%;
    max-height: 50vh;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

#preview-image {
    width: 100%;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
    display: block;
}

.selection-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn svg {
    width: 20px;
    height: 20px;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

#file-input-label {
    cursor: pointer;
}

#file-input {
    display: none;
}

#action-buttons {
    display: flex;
    gap: 12px;
}

.btn-confirm {
    background: #2ecc71;
    color: white;
}

.btn-confirm:hover,
.btn-confirm:focus {
    background: #27ae60;
}

.btn-cancel {
    background: var(--btn-bg);
    color: var(--text-primary);
}

.btn-cancel:hover,
.btn-cancel:focus {
    background: var(--btn-hover);
}

/* =====================
   Calendar Modal Styles
   ===================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 100%;
    border: 1px solid var(--border-color);
}

.modal-content h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.modal-content > p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator,
.form-group input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-buttons .btn {
    flex: 1;
    padding: 12px 20px;
}

/* About Modal */
.about-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.about-content .about-link {
    margin-bottom: 0;
}

.about-content a {
    color: var(--accent);
    text-decoration: none;
}

.about-content a:hover,
.about-content a:focus {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* =====================
   Responsive Adjustments
   ===================== */

@media (min-width: 768px) {
    .overlay-btn {
        width: 56px;
        height: 56px;
    }

    .overlay-btn svg {
        width: 28px;
        height: 28px;
    }

    #btn-close {
        right: 24px;
    }

    #btn-change-image {
        left: 24px;
    }

    #btn-calendar {
        left: 24px;
    }

    #btn-about {
        right: 24px;
    }

    .selection-container h1 {
        font-size: 2.5rem;
    }
}

/* Safe area padding for notched devices */
@supports (padding: env(safe-area-inset-top)) {
    #btn-close,
    #btn-change-image {
        margin-top: max(16px, env(safe-area-inset-top));
    }

    #btn-calendar,
    #btn-about {
        margin-bottom: max(16px, env(safe-area-inset-bottom));
    }
}
