@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;800&display=swap');

:root {
    color-scheme: dark;
    /* Luxury Dark Theme Palette */
    --bg-color: #08080a; /* Very deep almost black */
    --card-bg: rgba(255, 255, 255, 0.02);
    --card-border: rgba(255, 255, 255, 0.06);
    
    --text-primary: #f5f5f7;
    --text-secondary: #8e8e93;
    
    --accent-primary: #d4af37; /* Gold */
    --accent-secondary: #f3e5ab; /* Soft gold */
    --accent-gradient: linear-gradient(135deg, #e5c158 0%, #aa8327 100%);
    
    --success: #32d74b;
    --success-bg: rgba(50, 215, 75, 0.15);
    
    --danger: #ff453a;
    --danger-bg: rgba(255, 69, 58, 0.15);
    
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    --hover-shadow: 0 20px 50px rgba(212, 175, 55, 0.15);
    --blur: blur(24px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 0%, rgba(212, 175, 55, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 100%, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
    padding: 1.5rem 2.5rem;
    background: var(--card-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.logo-section h1 {
    font-size: 2.2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-section p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 3px;
    margin-top: 0.2rem;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Stats */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.stats-table th, .stats-table td {
    padding: 14px;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
}

.stats-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.count-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
}

.count-attendance {
    background: var(--success-bg);
    color: var(--success);
}

.count-absence {
    background: var(--danger-bg);
    color: var(--danger);
}

.monthly-log-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.monthly-log-container::-webkit-scrollbar {
    width: 6px;
}

.monthly-log-container::-webkit-scrollbar-track {
    background: transparent;
}

.monthly-log-container::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

/* Buttons */
.btn-icon {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    padding: 0.85rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: translateY(-3px) scale(1.05);
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.2);
    color: var(--accent-primary);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.15);
}

/* Mic Animation */
@keyframes pulse-mic {
    0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4); border-color: rgba(255, 69, 58, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(255, 69, 58, 0); border-color: rgba(255, 69, 58, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0); border-color: rgba(255, 69, 58, 0); }
}

.btn-icon.listening {
    animation: pulse-mic 1.5s infinite;
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Grid */
.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}

/* Card */
.member-card {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 2.2rem;
    border: 1px solid var(--card-border);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.member-card:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.3;
    transform: scale(0.95);
    background: transparent;
    border: 2px dashed var(--text-secondary);
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.member-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-shadow);
    border-color: rgba(212, 175, 55, 0.3);
}

.member-card:hover::before {
    opacity: 1;
}

.member-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.member-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s;
}

.member-info h3:hover {
    color: var(--accent-primary);
}

.member-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
}

.status-at-work {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(50, 215, 75, 0.2);
}

.status-off-work {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(255, 69, 58, 0.2);
}

/* Action Buttons */
.attendance-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.btn-attendance {
    padding: 1.2rem;
    border-radius: 16px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-size: 1rem;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-attendance::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.btn-attendance:hover::after {
    left: 150%;
}

.btn-in {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-in:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

.btn-out {
    background: var(--accent-gradient);
    color: #111;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.btn-out:hover:not([disabled]) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

/* History Section */
.history-section {
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-time {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-time:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #111114;
    padding: 2.5rem;
    border-radius: 28px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid var(--card-border);
}

.modal-content h2 {
    margin-bottom: 1.8rem;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.2rem;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #111;
    padding: 1rem 2rem;
    border-radius: 16px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}

/* Time Edit Modal specific */
.time-inputs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.time-inputs input {
    text-align: center;
    width: auto;
}

/* Decorations: Turned into subtle abstract luxury watermarks */
.decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.deco {
    position: absolute;
    width: clamp(80px, 15vw, 160px);
    animation: float 12s ease-in-out infinite;
    mix-blend-mode: screen;
    opacity: 0.05;
    filter: grayscale(100%) contrast(150%) blur(2px);
}

.deco-1 { top: 10%; left: -2vw; animation-delay: 0s; }
.deco-2 { bottom: 10%; right: -2vw; animation-delay: 3s; }
.deco-3 { top: 50%; left: 5vw; animation-delay: 6s; }

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    50% { transform: translateY(-40px) scale(1.05) rotate(10deg); }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1.5rem;
    }

    header {
        padding: 1.5rem;
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        border-radius: 20px;
    }

    .member-grid {
        grid-template-columns: 1fr;
    }
}