/* ==========================================================================
   Ling-Plan Admin Dashboard Styles
   ========================================================================== */

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

:root {
    --bg-deep: #020617;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.06);
    --cyan: #06b6d4;
    --cyan-glow: 0 0 25px rgba(6, 182, 212, 0.25);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Noto Sans KR', 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ==========================================================================
   Login View
   ========================================================================== */
.login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    padding: 2rem;
}

.login-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: glow-pulse 4s ease-in-out infinite;
}

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

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    z-index: 1;
    animation: card-in 0.5s ease forwards;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(59, 130, 246, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
}

.login-logo-icon i { width: 22px; height: 22px; }

.login-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.login-logo-text span { color: var(--cyan); }

.login-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.login-field {
    margin-bottom: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-wrap i {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.login-input-wrap input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.login-input-wrap input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.login-input-wrap input:focus + i,
.login-input-wrap input:focus ~ i {
    color: var(--cyan);
}

.login-error {
    font-size: 0.8rem;
    color: #ef4444;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.login-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--cyan) 0%, #0891b2 100%);
    color: #020617;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    transition: var(--transition);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--cyan-glow);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-btn i { width: 18px; height: 18px; }

/* ==========================================================================
   Dashboard View
   ========================================================================== */
.dashboard-view {
    animation: fade-in 0.4s ease forwards;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dashboard Header */
.dash-header {
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.dash-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-logo-area {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.dash-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(59, 130, 246, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
}

.dash-logo-icon i { width: 18px; height: 18px; }

.dash-logo-text {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.dash-logo-text span { color: var(--cyan); }

.dash-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.btn-logout i { width: 16px; height: 16px; }

/* Main Content */
.dash-main {
    padding: 2rem 0 4rem;
}

.dash-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.dash-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dash-title-row h1 {
    font-size: 1.75rem;
    font-weight: 800;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: var(--radius-sm);
    color: var(--cyan);
    font-family: inherit;
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-refresh:hover {
    background: rgba(6, 182, 212, 0.15);
    transform: translateY(-1px);
}

.btn-refresh i { width: 16px; height: 16px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i { width: 22px; height: 22px; }

.stat-icon-total {
    background: rgba(6, 182, 212, 0.1);
    color: var(--cyan);
}

.stat-icon-today {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-icon-week {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Table Card */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.table-header-bar h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-header-bar h3 i {
    width: 18px;
    height: 18px;
    color: var(--cyan);
}

.table-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Loading & Empty States */
.table-loading,
.table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
    color: var(--text-muted);
}

.table-loading i,
.table-empty i {
    width: 36px;
    height: 36px;
    color: var(--cyan);
}

.table-empty i {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Spin animation */
.animate-spin {
    animation: spin 1s linear infinite;
}

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

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: rgba(255, 255, 255, 0.02);
}

.data-table th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    vertical-align: top;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(6, 182, 212, 0.03);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr:nth-child(even):hover {
    background: rgba(6, 182, 212, 0.03);
}

/* Cell-specific styles */
.cell-id {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    width: 40px;
}

.cell-timestamp {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.cell-org {
    color: var(--text-primary);
    font-weight: 600;
}

.cell-name {
    color: var(--text-primary);
}

.cell-phone {
    color: var(--cyan);
    font-weight: 500;
    white-space: nowrap;
}

.cell-note {
    max-width: 200px;
    font-size: 0.825rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.cell-status {
    white-space: nowrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    font-weight: 700;
    background: rgba(6, 182, 212, 0.1);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dash-container {
        padding: 0 1rem;
    }

    .dash-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .dash-title-row h1 {
        font-size: 1.35rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.7rem 0.6rem;
    }

    .cell-note {
        max-width: 120px;
    }

    .dash-header-inner {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .btn-logout span {
        display: none;
    }
}
