/* QR 호출 시스템 - 스타일 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

/* ===== 로그인 페이지 ===== */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.login-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #e0e0e0;
}

.login-divider span {
    background: white;
    padding: 0 15px;
    color: #999;
    position: relative;
}

.login-info {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ===== 모달 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
}

.modal-info {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ===== 버튼 ===== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #43A047;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-download {
    background: #2196F3;
    color: white;
}

/* ===== 대시보드 ===== */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    font-size: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-nav {
    background: white;
    padding: 15px 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #e8e8e8;
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dashboard-content {
    flex: 1;
    padding: 30px;
}

.tab-panel {
    display: none;
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.panel-header h2 {
    color: #333;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== 카드 ===== */
.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: #f9f9f9;
    border-radius: 15px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

.card-body p {
    margin-bottom: 8px;
    color: #555;
}

.card-actions {
    padding: 15px 20px;
    background: #f0f0f0;
    display: flex;
    gap: 10px;
}

/* ===== 배지 ===== */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-warning {
    background: #FFF3E0;
    color: #E65100;
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}

/* ===== 통계 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
}

.stat-value {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 16px;
    opacity: 0.9;
}

/* ===== 폼 ===== */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.form-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form input,
.inline-form select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
}

.inline-form input {
    flex: 1;
    min-width: 150px;
}

.inline-form select {
    min-width: 130px;
}

.inline-form input:focus,
.inline-form select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-bar {
    margin-bottom: 20px;
}

.filter-bar select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

/* ===== 아이템 목록 ===== */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.item-info .badge {
    background: #E3F2FD;
    color: #1565C0;
}

.item-name {
    font-weight: 500;
    font-size: 16px;
}

.item-sub {
    color: #999;
    font-size: 13px;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #999;
}

.info-box {
    margin-top: 30px;
    padding: 20px;
    background: #E3F2FD;
    border-radius: 10px;
    color: #1565C0;
}

.info-box p {
    margin-bottom: 5px;
}

/* ===== 호출 목록 ===== */
.call-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.call-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    animation: slideIn 0.3s ease;
}

.call-item.confirmed {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    opacity: 0.8;
}

.call-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-confirmed {
    background: #9e9e9e;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.btn-confirmed:hover {
    background: #757575;
}

.call-actions .btn {
    padding: 5px 12px;
    font-size: 12px;
}

.call-actions .btn-small {
    padding: 5px 10px;
    font-size: 11px;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.call-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.call-class {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 14px;
}

.call-name {
    font-size: 18px;
    font-weight: bold;
}

.call-time {
    opacity: 0.8;
    font-size: 13px;
}

/* ===== 호출 로그 ===== */
.log-stats {
    margin-bottom: 10px;
    padding: 8px 14px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
}

.log-row {
    align-items: center;
}

.log-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.log-time {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.log-date {
    font-size: 11px;
    color: #888;
}

/* ===== 팝업 ===== */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: white;
    padding: 50px;
    border-radius: 25px;
    text-align: center;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-class {
    background: #E3F2FD;
    color: #1565C0;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 18px;
    display: inline-block;
    margin-bottom: 20px;
}

.popup-name {
    font-size: 52px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.popup-time {
    color: #666;
    margin-bottom: 30px;
    font-size: 18px;
}

/* ===== QR 코드 그리드 ===== */
.qr-loading-status {
    padding: 10px 15px;
    margin-bottom: 15px;
    background: #e3f2fd;
    border-radius: 8px;
    color: #1976d2;
    font-size: 14px;
    display: none;
}

.qr-loading-status.show {
    display: block;
}

.qr-grid {
    display: grid;
    gap: 20px;
}

.qr-grid.small {
    grid-template-columns: repeat(6, 1fr);
}

.qr-grid.medium {
    grid-template-columns: repeat(4, 1fr);
}

.qr-grid.large {
    grid-template-columns: repeat(3, 1fr);
}

.qr-card {
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    background: white;
}

.qr-card img {
    width: 100%;
    max-width: 180px;
    margin-bottom: 15px;
}

.qr-class {
    background: #E3F2FD;
    color: #1565C0;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    display: inline-block;
    margin-bottom: 8px;
}

.qr-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.qr-buttons {
    margin-top: 12px;
}

/* ===== 스캐너 페이지 ===== */
.scanner-body {
    background: #1a1a2e;
    color: white;
    min-height: 100vh;
    min-height: 100dvh; /* 모바일 브라우저 주소창 고려 */
    display: flex;
    flex-direction: column;
}

.scanner-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

/* 태블릿 화면 대응 */
@media (min-width: 768px) {
    .scanner-container {
        max-width: 600px;
        padding: 40px;
    }

    .scanner-header h1 {
        font-size: 32px;
    }

    #reader {
        max-width: 450px;
    }

    .result-name {
        font-size: 42px;
    }

    .scanner-controls .btn {
        padding: 20px 50px;
        font-size: 20px;
    }
}

/* 큰 태블릿/데스크톱 대응 */
@media (min-width: 1024px) {
    .scanner-container {
        max-width: 700px;
    }

    #reader {
        max-width: 500px;
    }

    .result-name {
        font-size: 48px;
    }
}

.scanner-header {
    text-align: center;
    margin-bottom: 25px;
}

.scanner-header h1 {
    font-size: 26px;
    margin-bottom: 15px;
}

.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
}

#reader {
    width: 100%;
    max-width: 350px;
    margin: 0 auto 25px;
    border-radius: 20px;
    overflow: hidden;
}

.scan-result {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 25px;
    animation: popIn 0.3s ease;
}

.scan-result.hidden {
    display: none;
}

.result-class {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 15px;
}

.result-name {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

.result-status {
    font-size: 18px;
}

.scanner-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}

.scanner-controls .btn {
    padding: 16px 40px;
    font-size: 18px;
}

#switch-camera-btn {
    background: #607d8b;
}

#switch-camera-btn:hover {
    background: #455a64;
}

.scanner-history h3 {
    text-align: center;
    margin-bottom: 20px;
}

#history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
}

.history-info {
    display: flex;
    gap: 12px;
}

.history-class {
    opacity: 0.7;
}

.history-name {
    font-weight: 500;
}

.history-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.empty-history {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 20px;
}

/* ===== 사용자 정보 버튼 ===== */
.user-info-btn {
    cursor: pointer;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s;
}

.user-info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.scanner-user {
    color: white;
    font-size: 14px;
}

/* ===== 유틸리티 ===== */
.hidden {
    display: none !important;
}

/* ===== 인쇄 ===== */
@media print {
    .no-print {
        display: none !important;
    }

    .dashboard-header,
    .dashboard-nav {
        display: none !important;
    }

    .dashboard-content {
        padding: 0;
    }

    .tab-panel {
        box-shadow: none;
    }

    .qr-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .dashboard-nav {
        justify-content: center;
    }

    .nav-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .dashboard-content {
        padding: 15px;
    }

    .call-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .call-info {
        flex-direction: column;
        gap: 10px;
    }

    .call-actions {
        width: 100%;
        justify-content: center;
    }

    .inline-form {
        flex-direction: column;
    }

    .qr-grid.small {
        grid-template-columns: repeat(3, 1fr);
    }

    .qr-grid.medium {
        grid-template-columns: repeat(2, 1fr);
    }

    .qr-grid.large {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-list {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 36px;
    }
}

/* ===== 관리자별 통계 ===== */
.admin-stats-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.stat-detail-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-detail-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-detail-header h4 {
    font-size: 18px;
    margin: 0;
}

.stat-detail-id {
    opacity: 0.8;
    font-size: 13px;
}

.stat-detail-body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 20px;
    gap: 10px;
}

.stat-detail-item {
    text-align: center;
}

.stat-detail-value {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.stat-detail-label {
    font-size: 12px;
    color: #666;
}

/* ===== 토스트 메시지 ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== QR 버튼 스타일 ===== */
.btn-copy, .btn-download, .btn-ment {
    padding: 8px 14px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy {
    background: #4CAF50 !important;
    color: white !important;
}

.btn-copy:hover {
    background: #43A047 !important;
}

.btn-copy.copied {
    background: #888 !important;
}

.btn-download {
    background: #2196F3 !important;
    color: white !important;
}

.btn-download:hover {
    background: #1976D2 !important;
}

.btn-ment {
    background: #E91E63 !important;
    color: white !important;
}

.btn-ment:hover {
    background: #C2185B !important;
}

/* ===== 큰 글씨 오버레이 (스캐너) ===== */
.big-name-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.big-name-overlay.show {
    opacity: 1;
}

.big-name-content {
    text-align: center;
    color: white;
    animation: bigNamePop 0.5s ease;
}

@keyframes bigNamePop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.big-name-class {
    font-size: 24px;
    opacity: 0.8;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 30px;
    border-radius: 30px;
    display: inline-block;
}

.big-name-text {
    font-size: 120px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 0 50px rgba(102, 126, 234, 0.8);
}

.big-name-status {
    font-size: 32px;
    color: #4CAF50;
}

@media (max-width: 768px) {
    .big-name-text {
        font-size: 60px;
    }

    .big-name-class {
        font-size: 18px;
    }

    .big-name-status {
        font-size: 24px;
    }

    .stat-detail-body {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-detail-value {
        font-size: 22px;
    }
}

/* ===== 안내 멘트 섹션 ===== */
.announcement-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.announcement-section .section-header {
    margin-bottom: 15px;
}

.announcement-section .section-header h3 {
    color: #333;
    font-size: 18px;
}

.announcement-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.announcement-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.3s;
}

.announcement-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.announcement-actions {
    display: flex;
    gap: 10px;
}

.announcement-actions .btn {
    padding: 12px 24px;
}

@media (max-width: 768px) {
    .announcement-actions {
        flex-direction: column;
    }

    .announcement-actions .btn {
        width: 100%;
    }
}

/* 로그인 보조 링크 */
.login-links { text-align: center; margin-top: 12px; font-size: 13px; }
.login-links a { color: #777; text-decoration: underline; }
.login-links a:hover { color: #333; }
