/* 모바일 PWA 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #dc3545;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 헤더 */
.app-header {
    background: var(--primary-color) !important;
    color: white !important;
    padding: 1rem !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    display: block !important;
    /* flex 해제하고 블록으로 변경하여 상하 2단 강제 */
}

.header-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.app-header h1 {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.app-header .user-info {
    font-size: 0.9rem !important;
    opacity: 0.8 !important;
    margin-top: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

/* install-toast (Android) */
.install-toast {
    position: fixed;
    bottom: 20px;
    left: 15px;
    right: 15px;
    background: #2c3e50;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 2000;
}

.install-toast-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.install-toast-text {
    flex: 1;
}

.install-toast-text strong {
    display: block;
    font-size: 0.95rem;
}

.install-toast-text span {
    font-size: 0.75rem;
    opacity: 0.8;
}

.btn-close-toast {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    padding: 0;
    cursor: pointer;
    opacity: 0.6;
}

/* iOS 전용 안내 레이어 */
.ios-install-prompt {
    position: fixed;
    bottom: 30px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: slideUpIn 0.5s ease-out;
}

.ios-prompt-content {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.ios-prompt-icon {
    font-size: 2rem;
    color: #333;
}

.ios-prompt-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #444;
}

.ios-prompt-text strong {
    color: #007aff;
    /* iOS Blue */
}

.ios-prompt-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #888;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
}

@keyframes slideUpIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 컨테이너 */
.container {
    max-width: 100%;
    padding: 1rem;
}

/* 로그인 폼 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 4rem;
    color: var(--primary-color);
}

.login-logo h1 {
    font-size: 1.5rem;
    margin-top: 1rem;
    color: #333;
}

/* 폼 요소 */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* 버튼 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

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

.btn-primary:active {
    background: #c82333;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* 장비 카드 */
.equipment-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.equipment-card:active {
    transform: scale(0.98);
}

.equipment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.equipment-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
}

.equipment-status {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-normal {
    background: #d4edda;
    color: #155724;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-danger {
    background: #f8d7da;
    color: #721c24;
}

.equipment-info {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.8;
}

/* 점검 체크리스트 */
.checklist {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.checklist-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.checklist-item label {
    flex: 1;
    cursor: pointer;
    user-select: none;
}

/* 사진 업로드 */
.photo-upload {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.photo-upload-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 2px dashed #ddd;
    border-radius: 0.5rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-btn:active {
    background: #e9ecef;
}

.upload-btn i {
    font-size: 2rem;
    color: #999;
}

/* 로딩 스피너 */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 알림 */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 하단 고정 버튼 */
.bottom-action {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* 설치 유도 토스트 */
.install-toast {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.25rem 1rem;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    animation: slideUp 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.install-toast-text {
    flex: 1;
    min-width: 0;
    color: white;
}

.install-toast-text strong {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    display: block;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.install-toast-text span {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.9);
    display: block;
    line-height: 1.4;
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 2rem;
    background: white;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.btn-sm:hover,
.btn-sm:active {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-close-toast {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.25rem;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close-toast:hover,
.btn-close-toast:active {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 텍스트 영역 */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* 유틸리티 */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.text-muted {
    color: #6c757d;
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

/* 다크모드 지원 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .equipment-card,
    .checklist,
    .photo-upload {
        background: #2a2a2a;
    }

    .form-control {
        background: #333;
        color: #e0e0e0;
        border-color: #444;
    }
}

/* 알림 아이콘 및 패널 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-badge-wrapper {
    position: relative;
    cursor: pointer;
    padding: 0.25rem;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ffc107;
    color: #000;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-color);
}

.notification-panel {
    position: fixed;
    top: 60px;
    left: 10px;
    right: 10px;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slidePanelDown 0.3s ease;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.panel-header h3 {
    font-size: 1.1rem;
    margin: 0;
    color: #333;
}

.btn-close-panel {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
}

.panel-body {
    overflow-y: auto;
    padding: 0;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.notification-item.unread {
    background: #fff9db;
}

.notification-item:last-child {
    border-bottom: none;
}

.notif-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.notif-body {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.4;
}

.notif-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.5rem;
}

@media (prefers-color-scheme: dark) {
    .notification-panel {
        background: #2a2a2a;
    }

    .panel-header {
        background: #333;
        border-bottom-color: #444;
    }

    .panel-header h3 {
        color: #e0e0e0;
    }

    .notification-item {
        border-bottom-color: #333;
    }

    .notification-item.unread {
        background: #3a3311;
    }

    .notif-body {
        color: #aaa;
    }
}