/* ==========================================
   TASKMASTER PWA - MAIN STYLESHEET
   Modern, Beautiful & Attractive Design
   ========================================== */

/* === ROOT VARIABLES === */
:root {
    /* Primary Colors */
    --primary-color: #405189;
    --primary-light: #5a6fb8;
    --primary-dark: #2d3a5f;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Accent Colors */
    --accent-color: #F7B84B;
    --accent-light: #ffd580;
    --accent-dark: #d69723;
    
    /* Status Colors */
    --success-color: #0AB39C;
    --success-light: #3dc9b3;
    --danger-color: #F06548;
    --danger-light: #ff8570;
    --warning-color: #f89406;
    --warning-light: #ffb347;
    --info-color: #299CDB;
    --info-light: #5db8e6;
    
    /* Neutral Colors */
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-tertiary: #edf2f7;
    --border-color: #e2e8f0;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Sizes */
    --header-height: 60px;
    --bottom-nav-height: 65px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index */
    --z-header: 1000;
    --z-menu: 1100;
    --z-overlay: 1050;
    --z-toast: 2000;
    --z-modal: 1200;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e0;
    --text-muted: #a0aec0;
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --border-color: #4a5568;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* === SPLASH SCREEN === */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.splash-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 20px;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.loader-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    animation: loading 1.5s ease-in-out infinite;
}

.splash-text {
    font-size: 14px;
    opacity: 0.9;
    animation: fadeInUp 0.6s ease 0.4s both;
}

@keyframes loading {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 50%;
        margin-left: 25%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* === APP CONTAINER === */
.app-container {
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* === LOGIN SCREEN === */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: var(--primary-gradient);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease;
}

.logo-container {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.app-title {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
}

.app-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.login-card {
    background: white;
    padding: 40px 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label i {
    font-size: 18px;
    color: var(--primary-color);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(64, 81, 137, 0.1);
}

.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--primary-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(64, 81, 137, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(64, 81, 137, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #0AB39C, #06d6a0);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #F06548, #ef476f);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f89406, #ffd166);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

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

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* === HEADER === */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    z-index: var(--z-header);
    box-shadow: var(--shadow-sm);
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
}

.header-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-btn {
    position: relative;
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* === MAIN CONTENT === */
.main-content {
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
    min-height: 100vh;
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 16px;
    z-index: var(--z-header);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    flex: 1;
    max-width: 100px;
}

.nav-item i {
    font-size: 24px;
    transition: var(--transition);
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-tertiary);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active i {
    transform: scale(1.1);
}

/* === SIDE MENU === */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: white;
    z-index: var(--z-menu);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
}

.side-menu.active {
    left: 0;
}

.menu-header {
    padding: 24px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-profile {
    flex: 1;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 12px;
}

.user-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.user-role {
    font-size: 14px;
    opacity: 0.9;
}

.menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.menu-content {
    padding: 16px 0;
}

.menu-section {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 15px;
    text-align: left;
    font-family: inherit;
    margin-bottom: 4px;
}

.menu-item i {
    font-size: 20px;
    color: var(--text-secondary);
}

.menu-item:hover {
    background: var(--bg-tertiary);
}

.menu-item.active {
    background: rgba(64, 81, 137, 0.1);
    color: var(--primary-color);
}

.menu-item.active i {
    color: var(--primary-color);
}

.logout-btn {
    color: var(--danger-color);
}

.logout-btn i {
    color: var(--danger-color);
}

.toggle-switch {
    margin-left: auto;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-switch label {
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    display: block;
}

.toggle-switch label::after {
    content: '';
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-switch input:checked + label {
    background: var(--primary-color);
}

.toggle-switch input:checked + label::after {
    left: 24px;
}

/* === MENU OVERLAY === */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
}

.toast.removing {
    animation: slideOutRight 0.3s ease;
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

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

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    transition: var(--transition);
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--info-color);
}

/* === INSTALL PROMPT === */
.install-prompt {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px);
    left: 16px;
    right: 16px;
    background: white;
    padding: 16px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    animation: slideInUp 0.3s ease;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.install-icon {
    font-size: 32px;
    color: var(--primary-color);
}

.install-text {
    flex: 1;
}

.install-text h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

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

.btn-close-install {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .login-card {
        padding: 30px 24px;
    }

    .toast {
        min-width: auto;
        max-width: calc(100vw - 32px);
    }

    .toast-container {
        left: 16px;
        right: 16px;
    }
}

/* === UTILITY CLASSES === */
.text-center {
    text-align: center;
}

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

.text-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.text-link:hover {
    text-decoration: underline;
}

.app-version {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-top: 24px;
    animation: fadeIn 0.6s ease 0.8s both;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Hide notification panel on login screen */
#login-screen ~ .notification-panel,
.login-container ~ .notification-panel {
    display: none !important;
}

/* Ensure toast container is properly positioned */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
}

/* Hide all panels when on login */
body:has(#login-screen.active) .notification-panel,
body:has(#login-screen.active) .install-prompt {
    display: none !important;
}

/* ==========================================
   NOTIFICATION PANEL FIX - Add to style.css
   ========================================== */

/* Fix notification panel visibility */
.notification-panel {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    width: 100% !important;
    max-width: 400px !important;
    height: 100vh !important;
    background: white !important;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1) !important;
    z-index: 1500 !important; /* Higher than other elements */
    transition: right 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.notification-panel.active {
    right: 0 !important;
}

/* Make sure panel header is visible */
.panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 20px !important;
    border-bottom: 1px solid #eee !important;
    background: #f8f9fa !important;
    flex-shrink: 0 !important;
}

.panel-header h3 {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

/* Make sure panel content is visible */
.panel-content {
    flex: 1 !important;
    overflow-y: auto !important;
    background: #f8f9fa !important;
}

/* Notification actions */
.notification-actions {
    padding: 15px 20px !important;
    border-bottom: 1px solid #eee !important;
    display: flex !important;
    justify-content: flex-end !important;
    background: white !important;
}

.notification-actions .btn-text {
    background: none !important;
    border: none !important;
    color: #4267B2 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    transition: background 0.2s !important;
}

.notification-actions .btn-text:hover {
    background: rgba(66, 103, 178, 0.1) !important;
}

/* Notification list */
.notification-list {
    padding: 10px !important;
    background: #f8f9fa !important;
}

/* Notification items - MUST BE VISIBLE */
.notification-item {
    display: flex !important;
    gap: 12px !important;
    padding: 15px !important;
    margin-bottom: 8px !important;
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.notification-item:hover {
    background: #f8f9fa !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.notification-item.unread {
    background: #f0f7ff !important;
    border-color: #4267B2 !important;
    border-width: 2px !important;
}

/* Notification icon */
.notification-icon {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    flex-shrink: 0 !important;
}

/* Icon colors */
.notification-icon.info {
    background: #e3f2fd !important;
    color: #1976d2 !important;
}

.notification-icon.test {
    background: #f5f5f5 !important;
    color: #666 !important;
}

.notification-icon.task_assigned {
    background: #e3f2fd !important;
    color: #1976d2 !important;
}

/* Notification content */
.notification-content {
    flex: 1 !important;
    min-width: 0 !important;
}

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

.notification-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    flex: 1 !important;
}

.unread-indicator {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    background: #4267B2 !important;
    border-radius: 50% !important;
    margin-top: 4px !important;
    flex-shrink: 0 !important;
}

.notification-body {
    font-size: 13px !important;
    color: #666 !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.5 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.notification-time {
    font-size: 12px !important;
    color: #999 !important;
}

/* Empty state */
.empty-state {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 60px 20px !important;
    text-align: center !important;
}

.empty-state i {
    font-size: 64px !important;
    color: #ddd !important;
    margin-bottom: 16px !important;
}

.empty-state p {
    font-size: 14px !important;
    color: #999 !important;
    margin: 0 !important;
}

/* Close button */
.close-panel {
    background: none !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.close-panel:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

.close-panel i {
    font-size: 20px !important;
    color: #666 !important;
}

/* Make sure panel is above everything */
.notification-panel {
    z-index: 9999 !important;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .notification-panel {
        max-width: 100% !important;
    }
}