/* ==================== LAYOUT STYLES ==================== */

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-splash);
}

.splash-content {
    text-align: center;
    z-index: 2;
}

.splash-logo {
    width: 100px;
    height: 100px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    animation: pulse-glow 2s infinite;
}

.splash-logo i {
    font-size: 3rem;
    color: white;
}

.splash-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.splash-tagline {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    margin: 0 auto;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    animation: loading 2s ease-in-out forwards;
}

@keyframes loading {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

.splash-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Auth Container */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-lg);
    overflow-y: auto;
}

.auth-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.auth-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-auth);
    animation: gradient-shift 10s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradient-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.auth-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: var(--space-xl);
    margin: auto;
    animation: slideUp 0.5s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.user-profile-trigger {
    position: relative;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 260px;
    padding: var(--space-md);
    z-index: var(--z-dropdown);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 0 20px rgba(255, 255, 255, 0.02);
    transform-origin: top right;
    animation: profileDropdownIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: rgba(15, 23, 42, 0.95);
    /* Slightly more opaque for the tip */
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    transform: rotate(45deg);
    z-index: -1;
}

@keyframes profileDropdownIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-header {
    padding: var(--space-md) var(--space-sm);
    margin-bottom: var(--space-xs);
}

.dropdown-header .user-name {
    display: block;
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.dropdown-header .user-role {
    display: block;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--primary-light);
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: var(--space-sm) 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.75rem var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    width: 100%;
    background: none;
    border: none;
    font-size: var(--font-size-sm);
    text-align: left;
    cursor: pointer;
}

.dropdown-item i {
    width: 18px;
    font-size: 1rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-item:hover i {
    color: var(--primary-light);
}

.drive-status-dropdown {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    margin: 0 var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.drive-status-dropdown:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.drive-status-dropdown i {
    font-size: 1.1rem;
    color: #4285F4;
    /* Google Blue */
}

.auth-logo {
    width: 70px;
    height: 70px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    cursor: pointer;
    transition: transform var(--transition-base);
}

.auth-logo:hover {
    transform: scale(1.05);
}

.auth-logo i {
    font-size: 2rem;
    color: white;
}

.auth-header h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--space-lg) 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 var(--space-md);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Admin Auth Theme */
.auth-container.admin-theme .auth-gradient {
    background: linear-gradient(135deg, #450a0a 0%, #991b1b 50%, #dc2626 100%);
}

.auth-container.admin-theme .auth-logo,
.auth-container.admin-theme .btn-primary {
    background: var(--gradient-admin);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header span:not(.sidebar-toggle),
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .drive-info,
.sidebar.collapsed .sidebar-logout-btn span {
    display: none;
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: var(--space-lg) 0;
}

.sidebar.collapsed .drive-indicator {
    justify-content: center;
}

.sidebar.collapsed .user-profile-summary {
    justify-content: center;
}

.sidebar.collapsed .sidebar-logout-btn {
    justify-content: center;
    padding: var(--space-sm);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    text-decoration: none;
    margin: 2px 0;
    position: relative;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.15) 0%, transparent 100%);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--gradient-primary);
    border-radius: 0 4px 4px 0;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-drive-status {
    padding: var(--space-lg);
    margin: var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.drive-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.drive-icon-wrapper {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.drive-info {
    display: flex;
    flex-direction: column;
}

.drive-info span {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
}

.drive-info small {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
}

.drive-indicator.connected .drive-icon-wrapper {
    background: rgba(52, 168, 83, 0.1);
    color: #34A853;
}

.drive-indicator.connected span {
    color: #34A853;
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: #ef4444;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.sidebar-logout-btn:hover {
    background: #ef4444;
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-base);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    border-radius: 0 !important;
    border-top: none;
    border-left: none;
    border-right: none;
    z-index: var(--z-sticky);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

#notification-btn,
#global-save-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

#add-todo-btn,
#upload-btn {
    height: 30px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

#notification-btn .notification-badge {
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#top-user-info {
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

#top-user-info:hover {
    opacity: 0.8;
}

.page-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    cursor: pointer;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-height);
    display: none;
    align-items: center;
    justify-content: space-around;
    border-radius: 0 !important;
    border-bottom: none;
    border-left: none;
    border-right: none;
    z-index: var(--z-sticky);
}

.bottom-nav .nav-item {
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm);
    font-size: var(--font-size-xs);
}

.bottom-nav .nav-item i {
    font-size: var(--font-size-lg);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-modal);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal.modal-lg {
    max-width: 700px;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: var(--font-size-lg);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

/* Wizard Progress */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    position: relative;
}

.wizard-step::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
}

.wizard-step:last-child::after {
    display: none;
}

.step-number {
    width: 30px;
    height: 30px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.wizard-step.active .step-number,
.wizard-step.completed .step-number {
    background: var(--primary);
    color: white;
}

.wizard-step.completed::after {
    background: var(--primary);
}

.wizard-step span {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.wizard-step.active span {
    color: var(--primary);
}

@media (max-width: 480px) {
    .wizard-step span {
        display: none;
    }

    .wizard-progress {
        padding: var(--space-md);
    }
}

/* Notification Panel */
.notification-panel {
    position: fixed;
    top: calc(var(--topbar-height) + var(--space-sm));
    right: var(--space-lg);
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.notification-list {
    padding: var(--space-sm);
}

.notification-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-glass);
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.1);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: toastSlideUp 0.3s ease-out;
    min-width: 300px;
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--info);
}

/* Responsive Layout */
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .page-content {
        padding: var(--space-md);
        padding-bottom: calc(var(--bottomnav-height) + var(--space-lg));
        max-width: 100vw;
        overflow-x: hidden;
    }

    .notification-panel {
        right: var(--space-md);
        left: var(--space-md);
        width: auto;
    }

    .top-bar {
        padding: 0.5rem var(--space-md);
        height: auto;
        min-height: var(--topbar-height);
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
        overflow: hidden;
    }

    .top-bar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .top-bar .btn span {
        display: none;
    }

    .top-bar .btn {
        padding: var(--space-sm);
        min-width: 40px;
    }

    #top-user-info .user-details {
        display: none !important;
    }

    .page-title {
        font-size: var(--font-size-lg);
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: calc(var(--z-sticky) - 1);
        transition: opacity var(--transition-normal);
    }

    .sidebar-mobile-hide {
        display: none !important;
    }
}

/* Calendar Event Styles */
.day-event.planned {
    background: var(--primary-light);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-event.goal {
    background: var(--secondary);
    color: white;
}

.day-event.deadline {
    background: var(--danger);
    color: white;
}

.pointer {
    cursor: pointer;
}

.calendar-day:hover:not(.other-month) {
    background: var(--bg-glass);
    border-color: var(--primary);
}