/* =============================================
   WORSHIP APP - BASE STYLES
   ============================================= */

/* ===== RESET ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-body);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--font-size-3xl);
}

h2 {
    font-size: var(--font-size-2xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

h5, h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-link-hover);
}

strong, b {
    font-weight: var(--font-weight-semibold);
}

small {
    font-size: var(--font-size-sm);
}

/* ===== LISTS ===== */
ul, ol {
    list-style: none;
}

/* ===== IMAGES ===== */
img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===== FORMS ===== */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

input,
select,
textarea {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-3) var(--space-4);
    width: 100%;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-10);
}

label {
    display: block;
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

/* Touch device form inputs */
@media (pointer: coarse) {
    input, select, textarea {
        min-height: var(--touch-target-min);
        font-size: max(var(--font-size-base), 16px); /* prevents iOS auto-zoom */
    }
    select {
        padding-right: var(--space-12);
    }
}

/* ===== TABLE ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: var(--font-weight-semibold);
    background-color: var(--bg-card);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius-full);
}

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

/* ===== SELECTION ===== */
::selection {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===== HIDDEN ===== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== PRINT ===== */
@media print {
    body {
        background: white;
        color: black;
    }

    .no-print {
        display: none !important;
    }
}

/* ===== APP LOADING STATE ===== */
.app-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-body, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loading);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.app-loading-logo {
    width: 64px;
    height: 64px;
    color: var(--color-primary, #6366f1);
    animation: pulse-loading 1.5s ease-in-out infinite;
}

.app-loading-logo svg {
    width: 100%;
    height: 100%;
}

.app-loading-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    letter-spacing: 0.05em;
}

@keyframes pulse-loading {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}
