/* ============================================
   工程查驗 APP - Base Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.5;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

a {
    color: var(--primary-400);
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-primary);
    padding-top: env(safe-area-inset-top, 0px);
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    z-index: var(--z-sticky);
    gap: var(--space-sm);
}

.app-header .header-title {
    flex: 1;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header .header-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-weight-regular);
    margin-left: var(--space-xs);
}

/* Header Buttons */
.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
    flex-shrink: 0;
    color: var(--text-secondary);
}

.header-btn:active {
    background: var(--bg-tertiary);
}

.header-btn .material-symbols-outlined {
    font-size: 24px;
}

/* Main Content */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-lg));
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.app-content.no-padding {
    padding-bottom: 0;
}

/* Page Container */
.page {
    display: none;
    padding: var(--space-lg);
    min-height: 100%;
    animation: fadeIn 0.25s ease;
}

.page.active {
    display: block;
}

.page.full-page {
    padding: 0;
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: var(--bottom-nav-height);
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    z-index: var(--z-sticky);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    gap: 2px;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
    position: relative;
}

.nav-item .material-symbols-outlined {
    font-size: 24px;
    transition: transform var(--transition-fast);
}

.nav-item span:last-child {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

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

.nav-item.active .material-symbols-outlined {
    transform: scale(1.1);
}

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

/* Badge on nav */
.nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--status-pending);
    color: white;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Section */
.section-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
    padding-left: var(--space-xs);
}

/* Material Icons */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* ============================================
   Responsive: Mobile constraint
   ============================================ */
@media (max-width: 767px) {
    #app {
        max-width: 480px;
    }
}

/* ============================================
   Responsive: Tablet (768px+)
   ============================================ */
@media (min-width: 768px) {
    .page {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }

    .app-header {
        padding: 0 var(--space-xl);
    }

    .bottom-nav {
        max-width: 600px;
        margin: 0 auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .header-btn:hover {
        background: var(--bg-tertiary);
    }

    .nav-item:hover {
        color: var(--primary-300);
    }

    .card:hover {
        border-color: var(--border-color);
    }
}

/* ============================================
   Responsive: Desktop (1200px+)
   ============================================ */
@media (min-width: 1200px) {
    .page {
        max-width: 960px;
    }

    .bottom-nav {
        max-width: 720px;
    }
}
