/* ============================
   HEMIS WebApp - Blue Theme
   ============================ */

:root {
    /* Blue Color Palette */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --secondary: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Neutral Colors */
    --bg-primary: #0c1929;
    --bg-secondary: #132337;
    --bg-tertiary: #1e3a5f;
    --text-primary: #f0f9ff;
    --text-secondary: #7dd3fc;
    --text-muted: #64748b;

    /* Glassmorphism */
    --glass-bg: rgba(19, 35, 55, 0.9);
    --glass-border: rgba(125, 211, 252, 0.1);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    --gradient-secondary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);

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

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

html,
body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Loading */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    z-index: 1000;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* ==================== Login ==================== */
.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    padding-top: calc(var(--spacing-lg) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.logo {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.login-header h1 {
    font-size: 32px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.login-form {
    width: 100%;
    max-width: 320px;
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.uni-search-wrap {
    position: relative;
}

.uni-search-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.uni-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.uni-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 200;
    -webkit-overflow-scrolling: touch;
}

.uni-dropdown.open {
    display: block;
}

.uni-option {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--glass-border);
}

.uni-option:last-child {
    border-bottom: none;
}

.uni-option:hover,
.uni-option:active {
    background: rgba(14, 165, 233, 0.15);
}

.uni-option.uni-empty {
    color: var(--text-muted);
    cursor: default;
    text-align: center;
}

.admin-contact {
    margin-top: var(--spacing-lg);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.admin-contact a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.3);
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.error-message {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 14px;
    text-align: center;
}

/* ==================== App Layout ==================== */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    padding-top: calc(var(--spacing-md) + 48px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-user-count {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.5;
    white-space: nowrap;
    z-index: 101;
    pointer-events: none;
}

/* Semester Bar */
.semester-bar {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
}

.semester-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.semester-bar-item label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.semester-bar-item select {
    padding: 8px 12px;
    font-size: 13px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%237dd3fc' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.semester-bar-item select:focus {
    outline: none;
    border-color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.avatar-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary);
    background: var(--bg-tertiary);
}

.user-details h2 {
    font-size: 16px;
    font-weight: 600;
}

.user-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-full);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-icon:hover {
    background: var(--primary);
}

.btn-icon:active {
    transform: scale(0.9);
    background: var(--primary-dark);
}

/* Navigation */
.nav-tabs {
    display: flex;
    background: var(--bg-secondary);
    padding: var(--spacing-sm);
    gap: 4px;
    border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--spacing-sm);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-icon {
    font-size: 18px;
}

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

.tab-btn:not(.active):hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Tab Content */
.tab-content {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

.tab-pane {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

/* ==================== Home Tab ==================== */
.home-welcome {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.home-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid white;
    margin-bottom: var(--spacing-md);
}

.home-welcome h2 {
    font-size: 20px;
    margin-bottom: var(--spacing-xs);
}

.home-welcome p {
    font-size: 14px;
    opacity: 0.9;
}

/* Notification Toggle */
.notification-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.notification-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 14px;
}

.toggle-switch {
    width: 50px;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.today-lessons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ==================== Schedule ==================== */
.week-filter {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.week-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    cursor: pointer;
}

.week-filter-header:hover {
    background: var(--bg-tertiary);
}

.week-filter-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
}

.week-filter-arrow {
    transition: transform 0.3s;
}

.week-filter.open .week-filter-arrow {
    transform: rotate(180deg);
}

.week-filter-content {
    display: none;
    padding: var(--spacing-sm);
    border-top: 1px solid var(--glass-border);
}

.week-filter.open .week-filter-content {
    display: block;
}

.week-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.week-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.week-btn:hover {
    background: var(--primary);
}

.week-btn.active {
    background: var(--gradient-primary);
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.day-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid transparent;
}

.day-card.today {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
}

.day-header {
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.day-card.today .day-header {
    background: var(--gradient-primary);
}

.day-name {
    font-weight: 600;
}

.day-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.day-card.today .day-date {
    color: rgba(255, 255, 255, 0.8);
}

.today-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

.day-lessons {
    padding: var(--spacing-sm);
}

.lesson-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

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

.lesson-time {
    min-width: 50px;
    text-align: center;
}

.time-start {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-light);
}

.time-end {
    font-size: 11px;
    color: var(--text-muted);
}

.lesson-subject {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.lesson-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.lesson-type {
    background: var(--primary);
    color: white;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
}

.no-lessons {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
}

/* ==================== Subjects ==================== */
.subjects-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.subject-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
}

.subject-name {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}

.subject-credit {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}

.subject-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

/* Semester Filter */
.semester-filter {
    margin-bottom: var(--spacing-md);
}

.semester-filter select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237dd3fc' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.semester-filter select:focus {
    outline: none;
    border-color: var(--primary);
}

.subject-stat {
    background: var(--bg-tertiary);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    text-align: center;
}

.subject-stat-value {
    font-size: 18px;
    font-weight: 700;
}

.subject-stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

.subject-stat-value.excellent {
    color: var(--success);
}

.subject-stat-value.good {
    color: var(--primary-light);
}

.subject-stat-value.warning {
    color: var(--warning);
}

.subject-stat-value.danger {
    color: var(--danger);
}

.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-fill.excellent {
    background: var(--gradient-success);
}

.progress-fill.good {
    background: var(--gradient-primary);
}

.progress-fill.warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.progress-fill.danger {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

/* ==================== Resources ==================== */
.resources-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.resource-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.resource-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    cursor: pointer;
}

.resource-header:hover {
    background: var(--bg-tertiary);
}

.resource-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Resources Toolbar */
.resources-toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.resources-toolbar .search-box {
    width: 100%;
}

.resources-toolbar .search-box input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    box-sizing: border-box;
}

.resources-toolbar .search-box input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.resources-toolbar .search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.resources-toolbar select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%237dd3fc' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.resource-arrow {
    transition: transform 0.3s;
}

.resource-card.open .resource-arrow {
    transform: rotate(180deg);
}

.resource-content {
    max-height: 0;
    overflow: hidden;
    border-top: 1px solid var(--glass-border);
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 var(--spacing-md);
}

.resource-card.open .resource-content {
    max-height: 5000px;
    padding: var(--spacing-md);
}

.resource-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
}

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

.resource-item-name {
    font-size: 13px;
}

.resource-item-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.resource-item-btn:hover {
    background: var(--primary-dark);
}

.resource-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.resource-item-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-item-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* Subject Grades */
.subject-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--glass-border);
}

.subject-grades {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-xs);
}

.grade-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    text-align: center;
}

.grade-box.total {
    background: var(--primary);
}

.grade-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.grade-box.total .grade-label {
    color: rgba(255, 255, 255, 0.8);
}

.grade-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.grade-value.excellent {
    color: var(--success);
}

.grade-value.good {
    color: var(--primary-light);
}

.grade-value.warning {
    color: var(--warning);
}

.grade-value.danger {
    color: var(--danger);
}

/* ==================== Profile ==================== */
.profile-header {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.profile-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid white;
    margin-bottom: var(--spacing-md);
}

.profile-header h2 {
    font-size: 20px;
    margin-bottom: var(--spacing-xs);
}

.profile-header p {
    opacity: 0.9;
}

/* Profile Stats Badges */
.profile-stats-badges {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.stat-badge {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.stat-badge-icon {
    font-size: 28px;
}

.stat-badge-info {
    flex: 1;
}

.stat-badge-title {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-badge-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-badge-message {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.stat-badge-message.good {
    color: var(--success);
}

.stat-badge-message.warning {
    color: var(--warning);
}

.stat-badge-message.danger {
    color: var(--danger);
}

/* Accordion Sections */
.accordion {
    margin-bottom: var(--spacing-md);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: var(--bg-tertiary);
}

.accordion-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.accordion-arrow {
    transition: transform 0.3s;
}

.accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion.open .accordion-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 var(--spacing-md);
}

.accordion.open .accordion-content {
    max-height: 500px;
    padding: var(--spacing-md);
}

.profile-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--glass-border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-value {
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    font-size: 14px;
}

.profile-value.clickable {
    color: var(--primary-light);
    cursor: pointer;
}

/* Document Download */
.document-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.document-name {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.document-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
}

.document-btn:hover {
    background: var(--primary-dark);
}

.profile-actions {
    text-align: center;
    margin-top: var(--spacing-lg);
}

.btn-danger {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--danger);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-xl);
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

.empty-state-text {
    color: var(--text-muted);
}

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-card {
    height: 80px;
    margin-bottom: var(--spacing-md);
}

/* ==================== Devices ==================== */
.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    border: 2px solid transparent;
}

.device-item.current-device {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.1);
}

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

.device-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.current-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
}

.device-tg {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.device-time {
    font-size: 12px;
    color: var(--text-muted);
}

.device-remove-btn {
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.15);
    border: none;
    border-radius: var(--radius-full);
    color: var(--danger);
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: var(--spacing-sm);
    transition: background 0.2s;
}

.device-remove-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}