/* ===================================
   SVA Common CSS - 스마트자가건강관리서비스
   공통 스타일 시트
   =================================== */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary-blue: #4e73df;
    --primary-blue-light: #6b8cef;
    --primary-blue-dark: #3756bd;
    --primary-gradient: linear-gradient(135deg, #4e73df 0%, #6b8cef 100%);

    /* Secondary Colors */
    --secondary-green: #1cc88a;
    --secondary-cyan: #36b9cc;
    --secondary-yellow: #f6c23e;
    --secondary-red: #e74a3b;
    --secondary-orange: #fd7e14;

    /* Status Colors */
    --status-good: #1cc88a;
    --status-normal: #36b9cc;
    --status-caution: #f6c23e;
    --status-warning: #fd7e14;
    --status-danger: #e74a3b;

    /* Background Colors */
    --bg-color: #f4f7f9;
    --bg-white: #ffffff;
    --bg-light: #f8f9fc;
    --bg-card: #ffffff;
    --bg-section: #eef2f7;

    /* Text Colors */
    --text-dark: #333333;
    --text-primary: #444444;
    --text-secondary: #666666;
    --text-muted: #858796;
    --text-light: #999999;

    /* Border Colors */
    --border-color: #e3e6f0;
    --border-light: #eee;

    /* Chart Colors */
    --chart-blue: #4e73df;
    --chart-blue-light: rgba(78, 115, 223, 0.3);
    --chart-green: #1cc88a;
    --chart-cyan: #36b9cc;
    --chart-yellow: #f6c23e;
    --chart-orange: #fd7e14;
    --chart-gray: #dddfeb;

    /* Social Colors */
    --kakao-yellow: #fee500;
    --naver-green: #03c75a;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 30px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Font Sizes */
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;
    --font-4xl: 2.25rem;

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--primary-blue);
}

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

ul, ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

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

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-md);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--spacing-lg) 0;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(var(--spacing-md) * -0.5);
}

.col {
    flex: 1;
    padding: 0 calc(var(--spacing-md) * 0.5);
}

.col-auto { flex: 0 0 auto; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }

/* Flex Utilities */
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Header */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 var(--spacing-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-symbol {
    width: 36px;
    height: 36px;
    background: var(--primary-blue);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-bold);
    font-size: var(--font-sm);
}

.logo-text {
    font-size: var(--font-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-blue);
    background: rgba(78, 115, 223, 0.1);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-blue);
    border-radius: 2px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xs);
    gap: var(--spacing-xs);
}

.tab-item {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--text-primary);
}

.tab-item.active {
    background: var(--bg-white);
    color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: var(--font-lg);
    font-weight: var(--font-bold);
    color: var(--text-dark);
}

.card-subtitle {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

/* Stats Card */
.stats-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-card);
}

.stats-value {
    font-size: var(--font-4xl);
    font-weight: var(--font-bold);
    color: var(--text-dark);
    line-height: 1.2;
}

.stats-label {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.stats-change {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.stats-change.positive {
    color: var(--status-good);
    background: rgba(28, 200, 138, 0.1);
}

.stats-change.negative {
    color: var(--status-danger);
    background: rgba(231, 74, 59, 0.1);
}

/* Progress Bar */
.progress {
    height: 8px;
    background: var(--bg-section);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar.animated {
    animation: progressAnimation 1.5s ease-out forwards;
}

@keyframes progressAnimation {
    from { width: 0; }
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: rgba(78, 115, 223, 0.15);
    color: var(--primary-blue);
}

.badge-success {
    background: rgba(28, 200, 138, 0.15);
    color: var(--status-good);
}

.badge-info {
    background: rgba(54, 185, 204, 0.15);
    color: var(--secondary-cyan);
}

.badge-warning {
    background: rgba(246, 194, 62, 0.15);
    color: var(--secondary-yellow);
}

.badge-danger {
    background: rgba(231, 74, 59, 0.15);
    color: var(--status-danger);
}

/* Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
}

.status-dot.good { background: var(--status-good); }
.status-dot.normal { background: var(--status-normal); }
.status-dot.caution { background: var(--status-caution); }
.status-dot.warning { background: var(--status-warning); }
.status-dot.danger { background: var(--status-danger); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-section);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-md);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-xs);
}

/* Input Fields */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.form-control {
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--font-md);
    color: var(--text-dark);
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.15);
}

/* Charts Container */
.chart-container {
    position: relative;
    width: 100%;
    height: 200px;
}

.chart-container.chart-lg {
    height: 300px;
}

.chart-container.chart-sm {
    height: 150px;
}

/* Score Display */
.score-display {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-xs);
}

.score-value {
    font-size: var(--font-3xl);
    font-weight: var(--font-bold);
    color: var(--primary-blue);
}

.score-unit {
    font-size: var(--font-md);
    color: var(--text-muted);
}

/* Info Box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.info-box-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-blue);
    color: white;
    border-radius: var(--radius-md);
}

.info-box-content {
    flex: 1;
}

.info-box-title {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    color: var(--text-dark);
}

.info-box-text {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-light);
}

.table td {
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-light);
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.section-title h2 {
    font-size: var(--font-2xl);
    font-weight: var(--font-bold);
    color: var(--text-dark);
}

.section-title .subtitle {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* Section Header with Icon */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.section-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border-radius: var(--radius-lg);
    color: white;
    font-size: var(--font-2xl);
}

/* Page Title */
.page-title {
    font-size: var(--font-3xl);
    font-weight: var(--font-bold);
    color: var(--text-dark);
}

.page-subtitle {
    font-size: var(--font-md);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--spacing-lg) 0;
}

/* Summary Section */
.summary-section {
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

.summary-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
}

.summary-title {
    font-size: var(--font-2xl);
    font-weight: var(--font-bold);
    color: var(--text-dark);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.summary-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.summary-item {
    margin-bottom: var(--spacing-md);
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-item-title {
    font-size: var(--font-md);
    font-weight: var(--font-semibold);
    color: var(--primary-blue);
    margin-bottom: var(--spacing-xs);
}

.summary-item-text {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes countUp {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Animation Classes */
.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease forwards; }
.animate-slide-left { animation: slideInLeft 0.5s ease forwards; }
.animate-slide-right { animation: slideInRight 0.5s ease forwards; }
.animate-scale-in { animation: scaleIn 0.5s ease forwards; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-bounce { animation: bounce 2s ease infinite; }

/* Staggered Animation Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-blue); }
.text-success { color: var(--status-good); }
.text-warning { color: var(--secondary-yellow); }
.text-danger { color: var(--status-danger); }
.text-muted { color: var(--text-muted); }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.hidden { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Responsive Utilities */
@media (max-width: 1200px) {
    .container {
        max-width: 992px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 768px;
    }

    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }

    .hidden-md { display: none !important; }
}

@media (max-width: 768px) {
    :root {
        --spacing-lg: 20px;
        --spacing-xl: 28px;
        --font-3xl: 1.5rem;
        --font-4xl: 1.875rem;
    }

    .container {
        max-width: 100%;
        padding: 0 var(--spacing-md);
    }

    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }

    .header-inner {
        padding: 0 var(--spacing-md);
    }

    .nav {
        gap: 0;
    }

    .nav-link {
        padding: var(--spacing-sm);
        font-size: var(--font-xs);
    }

    .card {
        border-radius: var(--radius-lg);
    }

    .card-body {
        padding: var(--spacing-md);
    }

    .hidden-sm { display: none !important; }
}

@media (max-width: 576px) {
    :root {
        --spacing-md: 12px;
        --spacing-lg: 16px;
        --font-2xl: 1.25rem;
        --font-3xl: 1.375rem;
    }

    .page-title {
        font-size: var(--font-xl);
    }

    .stats-value {
        font-size: var(--font-2xl);
    }

    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-item {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .hidden-xs { display: none !important; }
}

/* Print Styles */
@media print {
    .header,
    .nav,
    .btn,
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    body {
        background: white;
    }
}
