/* ==================== CSS Variables ==================== */
:root {
    --color-primary: #007aff;
    --color-primary-hover: #0051d5;
    --color-text: #1d1d1f;
    --color-text-secondary: #86868b;
    --color-text-light: #a1a1a6;
    --color-border: #d2d2d7;
    --color-bg: #ffffff;
    --color-bg-secondary: #f5f5f7;
    --color-success: #34c759;
    --color-warning: #ff9500;
    --color-error: #ff3b30;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
    --radius-full: 980px;
    --transition: all 0.2s ease;
    --font-mono: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
                 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== Login Page ==================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 20px;
}

.login-card {
    background: var(--color-bg);
    padding: 40px;
    animation: slideUp 0.5s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-header p {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 400;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.form-group input {
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    transition: var(--transition);
    background: var(--color-bg-secondary);
    font-family: inherit;
}

.form-group input::placeholder {
    color: var(--color-text-light);
}

.form-group input:focus {
    outline: none;
    background: #ebebf0;
}

.error-message {
    padding: 12px 16px;
    background: rgba(255, 59, 48, 0.08);
    color: var(--color-error);
    border-radius: var(--radius-full);
    font-size: 13px;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* ==================== Main Page ==================== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 48px 32px 32px;
    animation: fadeIn 0.4s ease;
}

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

.page-header {
    margin-bottom: 10px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.header-left h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.session-count {
    font-size: 15px;
    color: var(--color-text-secondary);
    font-weight: 400;
    margin-bottom: 32px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.doctor-name {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 400;
}

.actions-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #e8e8ed;
}

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

.btn-ghost:hover {
    color: var(--color-primary-hover);
}

.btn-ghost:active {
    color: #0040a8;
}

.btn-block {
    width: 100%;
    padding: 11px 18px;
}

/* ==================== Sessions Grid ==================== */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.session-card {
    background: var(--color-bg);
    border-radius: 16px;
    padding: 20px;
    border: none;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    animation: cardIn 0.4s ease;
}

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

.session-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.session-header {
    display: flex;
    align-items: start;
    gap: 12px;
    margin-bottom: 16px;
}

.checkbox-wrapper {
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    opacity: 0;
    position: absolute;
    z-index: 2;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: var(--color-bg-secondary);
    position: relative;
}

.checkbox:checked + .checkbox-custom {
    background: var(--color-primary);
}

.checkbox:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.checkbox:hover + .checkbox-custom {
    background: #e8e8ed;
}

.checkbox:checked:hover + .checkbox-custom {
    background: var(--color-primary-hover);
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-meta {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 400;
    margin-top: 10px;
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.status-completed {
    background: rgba(52, 199, 89, 0.12);
    color: #248a3d;
}

.status-completed::before {
    background: #248a3d;
}

.status-in-progress {
    background: rgba(255, 149, 0, 0.12);
    color: #c27200;
}

.status-in-progress::before {
    background: #c27200;
}

.status-draft {
    background: rgba(142, 142, 147, 0.12);
    color: #6e6e73;
}

.status-draft::before {
    background: #6e6e73;
}

.status-cancelled {
    background: rgba(255, 59, 48, 0.12);
    color: #c92a2a;
}

.status-cancelled::before {
    background: #c92a2a;
}

.export-btn {
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: var(--color-bg-secondary);
    color: var(--color-text);
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

/* ==================== States ==================== */
.loading,
.empty-state,
.error-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-secondary);
    grid-column: 1 / -1;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state p {
    font-size: 15px;
    color: var(--color-text-secondary);
}

.error-state {
    color: var(--color-error);
}

/* ==================== Selected Count Badge ==================== */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ==================== Responsive ==================== */
@media (max-width: 1400px) {
    .sessions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 40px 24px 24px;
    }

    .header-left h1 {
        font-size: 28px;
    }

    .sessions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 32px 20px 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .header-left h1 {
        font-size: 24px;
    }

    .session-count {
        font-size: 14px;
        margin-bottom: 24px;
    }

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

    .actions-bar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}
