/**
 * Japa Maala - Mantra Counter Styles
 * Clean, modular CSS with spiritual aesthetics
 */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */
:root {
    --color-bg: #1a1410;
    --color-surface: #2a2318;
    --color-surface-hover: #3a3128;
    --color-primary: #d4a574;
    --color-accent: #f4d58d;
    --color-text: #f5f1e8;
    --color-text-dim: #9a8f7e;
    --color-delete: #c45555;
    --color-success: #6fbf73;
    --color-error: #e57373;
    --font-display: 'Cinzel', serif;
    --font-body: 'Crimson Pro', serif;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--color-bg) 0%, #0f0d0a 100%);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(212, 165, 116, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(244, 213, 141, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   HEADER
   ============================================================================ */
header {
    padding: 2rem 1.5rem 1rem;
    text-align: center;
    opacity: 0;
    animation: fadeInDown 0.6s ease forwards;
    position: relative;
}

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

h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(212, 165, 116, 0.2);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--color-text-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-button {
    position: absolute;
    top: 2rem;
    right: 1.5rem;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.3);
    color: var(--color-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-button:hover {
    background: rgba(212, 165, 116, 0.2);
    border-color: var(--color-primary);
}

/* ============================================================================
   SYNC INDICATOR
   ============================================================================ */
.sync-indicator {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(111, 191, 115, 0.95);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    transition: transform 0.3s ease;
}

.sync-indicator.show {
    transform: translateX(-50%) translateY(0);
}

/* ============================================================================
   SIGN-IN PROMPT BANNER
   ============================================================================ */
.signin-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: var(--color-bg);
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: 2000;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
}

.signin-prompt.show {
    transform: translateY(0);
}

.signin-prompt-content {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.signin-prompt-text {
    flex: 1;
}

.signin-prompt-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}

.signin-prompt-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

.signin-prompt-actions {
    display: flex;
    gap: 0.75rem;
}

.signin-prompt-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
}

.signin-prompt-btn.primary {
    background: var(--color-bg);
    color: var(--color-primary);
}

.signin-prompt-btn.secondary {
    background: transparent;
    color: var(--color-bg);
    border: 1px solid var(--color-bg);
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.nav-tabs {
    display: flex;
    gap: 1rem;
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.nav-tab {
    padding: 1rem 1.5rem;
    font-family: var(--font-display);
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-dim);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.nav-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-tab.active {
    color: var(--color-primary);
}

.nav-tab.active::after {
    transform: scaleX(1);
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
main {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    flex: 1;
    opacity: 0;
}

.view.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}

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

/* ============================================================================
   EMPTY STATE
   ============================================================================ */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.empty-state p {
    color: var(--color-text-dim);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: var(--color-bg);
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(212, 165, 116, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(212, 165, 116, 0.5);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================================================
   MANTRA LIST
   ============================================================================ */
.mantra-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mantra-card {
    background: var(--color-surface);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: slideInUp 0.5s ease forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mantra-card:nth-child(2) { animation-delay: 0.1s; }
.mantra-card:nth-child(3) { animation-delay: 0.2s; }
.mantra-card:nth-child(4) { animation-delay: 0.3s; }

.mantra-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mantra-card:hover::before {
    opacity: 1;
}

.mantra-card:hover {
    transform: translateY(-4px);
    border-color: rgba(212, 165, 116, 0.4);
    box-shadow: 0 8px 30px rgba(212, 165, 116, 0.15);
}

.mantra-card-content {
    position: relative;
    z-index: 1;
}

.mantra-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.mantra-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 2;
}

.icon-btn {
    background: rgba(26, 20, 16, 0.8);
    border: 1px solid rgba(212, 165, 116, 0.3);
    color: var(--color-text-dim);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.icon-btn:hover {
    background: var(--color-delete);
    color: var(--color-text);
    border-color: var(--color-delete);
    transform: scale(1.1);
}

/* ============================================================================
   FLOATING ADD BUTTON
   ============================================================================ */
.add-mantra-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: var(--color-bg);
    border: none;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(212, 165, 116, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

.add-mantra-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 12px 40px rgba(212, 165, 116, 0.6);
}

/* ============================================================================
   MODALS
   ============================================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--color-surface);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 24px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideInUp 0.3s ease;
}

.modal-header {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-align: center;
}

/* ============================================================================
   SIGN-IN MODAL (GOOGLE)
   ============================================================================ */
.signin-modal-content {
    max-width: 420px;
}

.signin-description {
    text-align: center;
    color: var(--color-text-dim);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.signin-data-notice {
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    animation: slideInUp 0.3s ease;
}

.data-notice-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--color-primary);
    margin-top: 2px;
}

.data-notice-text {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
}

.signin-error {
    background: rgba(229, 115, 115, 0.15);
    border: 1px solid var(--color-error);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--color-error);
    font-size: 0.875rem;
    text-align: center;
    animation: slideInUp 0.3s ease;
}

.google-signin-btn {
    width: 100%;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    color: #3c4043;
    margin-bottom: 1.5rem;
}

.google-signin-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #c6c6c6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-signin-btn:active:not(:disabled) {
    background: #f1f3f4;
}

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

.google-signin-btn.loading {
    opacity: 0.7;
}

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.signin-privacy {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-dim);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.signin-close-btn {
    width: 100%;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-dim);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    background: var(--color-bg);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 12px;
    padding: 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

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

/* ============================================================================
   COUNTING SESSION
   ============================================================================ */
.counting-session {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
    user-select: none;
}

.counting-session.active {
    display: flex;
}

.session-mantra-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--color-primary);
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
}

.count-display {
    font-family: var(--font-display);
    font-size: 8rem;
    color: var(--color-accent);
    font-weight: 600;
    text-shadow: 0 0 60px rgba(244, 213, 141, 0.4);
    margin-bottom: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

.count-display.milestone {
    animation: milestone 0.6s ease;
}

@keyframes milestone {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--color-primary); }
}

.target-display {
    font-size: 1rem;
    color: var(--color-text-dim);
    letter-spacing: 0.1em;
    margin-bottom: 4rem;
}

.instruction-text {
    font-size: 1rem;
    color: var(--color-text-dim);
    text-align: center;
    line-height: 1.8;
    max-width: 400px;
    opacity: 0.6;
}

.session-state {
    font-size: 0.875rem;
    color: var(--color-accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    background: rgba(244, 213, 141, 0.1);
    border: 1px solid rgba(244, 213, 141, 0.3);
}

.session-state.active {
    color: #6fbf73;
    background: rgba(111, 191, 115, 0.1);
    border-color: rgba(111, 191, 115, 0.3);
}

.session-state.paused {
    color: #f4a261;
    background: rgba(244, 162, 97, 0.1);
    border-color: rgba(244, 162, 97, 0.3);
}

.back-button {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(26, 20, 16, 0.8);
    border: 1px solid rgba(212, 165, 116, 0.3);
    color: var(--color-text);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.back-button:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

/* ============================================================================
   JAPASESSIONS
   ============================================================================ */
.japasessions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.japasessions-card {
    background: var(--color-surface);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    animation: slideInUp 0.5s ease forwards;
}

.japasessions-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.japasessions-mantra {
    font-family: var(--font-display);
    font-size: 1.125rem;
    color: var(--color-primary);
    letter-spacing: 0.05em;
}

.japasessions-count {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-accent);
}

.japasessions-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-dim);
}

.japasessions-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.japasessions-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* ============================================================================
   TOUCH FEEDBACK
   ============================================================================ */
@keyframes touchFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.touch-active {
    animation: touchFeedback 0.15s ease;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 640px) {
    h1 {
        font-size: 1.5rem;
    }

    .count-display {
        font-size: 6rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .auth-button {
        position: static;
        margin-top: 1rem;
    }

    .signin-prompt-content {
        flex-direction: column;
        align-items: stretch;
    }

    .signin-prompt-actions {
        width: 100%;
    }

    .signin-prompt-btn {
        flex: 1;
    }

    .google-signin-btn {
        font-size: 0.9375rem;
        padding: 0.875rem 1.25rem;
    }

    .signin-description {
        font-size: 0.875rem;
    }
}

/* ============================================================================
   LOADING OVERLAY
   ============================================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 20, 16, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    display: flex;
    opacity: 1;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.spinner-ring {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 165, 116, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-text {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ============================================================================
   CONFIRMATION MODAL
   ============================================================================ */
.confirmation-modal-content {
    max-width: 400px;
    text-align: center;
}

.confirmation-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.confirmation-message {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: 2rem;
    white-space: pre-line;
}

.confirmation-actions {
    display: flex;
    gap: 1rem;
}

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

.btn-danger {
    background: linear-gradient(135deg, #c45555, #e57373);
    color: white;
    box-shadow: 0 4px 20px rgba(196, 85, 85, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(196, 85, 85, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, #f4a261, #e76f51);
    color: white;
    box-shadow: 0 4px 20px rgba(244, 162, 97, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(244, 162, 97, 0.5);
}
