/* Main Styles */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow selection only in input fields */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Disable image dragging */
img, svg {
    pointer-events: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Disable text highlighting */
::selection {
    background: transparent;
}
::-moz-selection {
    background: transparent;
}

body { 
    -webkit-tap-highlight-color: transparent; 
    overscroll-behavior: none;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Modal overlay - matches app container width */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    max-width: 28rem !important; /* max-w-md = 28rem */
    height: 100vh !important;
    height: 100dvh !important;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    box-sizing: border-box;
}

/* On mobile, use full width */
@media (max-width: 767px) {
    .modal-overlay {
        left: 0 !important;
        transform: none !important;
        width: 100vw !important;
        max-width: none !important;
    }
}

/* Ensure modal content fits within container */
.modal-overlay > div {
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* Timer floating overlay - sticky at bottom of viewport */
.timer-floating-overlay {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    right: 20px !important;
    z-index: 100;
    pointer-events: none; /* Allow clicks through overlay */
}

.timer-floating-card {
    pointer-events: auto; /* Re-enable clicks on the card */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Minimized timer circle */
.timer-minimized-circle {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 101;
    transition: transform 0.2s ease;
}

.timer-minimized-circle:active {
    transform: scale(0.95);
}

.timer-minimized-circle .timer-seconds {
    color: white;
    font-weight: bold;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

/* iOS touch fix */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.input-fade { 
    transition: background 0.3s; 
}

.timer-pulse { 
    animation: pulse 1s infinite; 
}

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

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] { 
    -moz-appearance: textfield; 
}

/* Swipe back indicator */
.swipe-indicator {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(to right, rgba(59, 130, 246, 0.3), transparent);
    pointer-events: none;
    opacity: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 8px;
    transition: opacity 0.15s ease-out;
}

.swipe-indicator.active {
    opacity: 1;
}

.swipe-indicator.triggered {
    background: linear-gradient(to right, rgba(34, 197, 94, 0.5), transparent);
}

.swipe-arrow {
    width: 24px;
    height: 24px;
    border-left: 3px solid white;
    border-bottom: 3px solid white;
    transform: rotate(45deg);
    opacity: 0.8;
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.3));
}

/* Screen transition animations */
.screen-container {
    min-height: 100vh;
    position: relative;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out forwards;
}

.slide-out-right {
    animation: slideOutRight 0.3s ease-out forwards;
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out forwards;
}

.slide-out-left {
    animation: slideOutLeft 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0.5;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0.5;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-30%);
        opacity: 0.5;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-30%);
        opacity: 0.5;
    }
}