/* =========================================================
   ZeNote (زی نوت) - Master UI Stylesheet
   Pure Modern CSS with Glassmorphism, Animated Ambient Blobs
   ========================================================= */

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.12);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --secondary: #ec4899;
    --accent: #14b8a6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-glow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global Rules */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

body {
    font-family: 'Vazirmatn', 'B Yekan', Tahoma, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Ambient Glowing Blobs Background */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0f172a 100%);
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    animation: blob-float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: #4f46e5;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: #db2777;
    bottom: -100px;
    left: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: #0d9488;
    top: 40%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes blob-float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -50px) scale(1.1); }
    66% { transform: translate(-40px, 80px) scale(0.9); }
    100% { transform: translate(30px, 40px) scale(1.05); }
}

/* Dynamic Floating Particles Container */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Main Layout Wrapper */
.app-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 80px;
    padding-bottom: 70px;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Glassmorphism Cards & Panels */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

/* Sticky Fixed Glass Header & Footer */
.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--bg-card-border);
    z-index: 1000;
}

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

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-tag {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.desktop-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.admin-badge {
    color: #f43f5e !important;
}

.glass-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--bg-card-border);
    z-index: 900;
    display: flex;
    align-items: center;
}

.footer-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* Forms & UI Controls */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

/* Captcha Block */
.captcha-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.captcha-img {
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-card-border);
    cursor: pointer;
    height: 45px;
}

/* Pastel Notes Grid & Cards */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.note-card {
    border-radius: var(--radius-md);
    padding: 20px;
    color: #1e293b;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 240px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.note-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.note-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card-body {
    font-size: 14px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 12px;
    color: rgba(30, 41, 59, 0.7);
}

.pastel-blue { background: #e0f2fe; }
.pastel-green { background: #dcfce7; }
.pastel-yellow { background: #fef9c3; }
.pastel-purple { background: #f3e8ff; }
.pastel-pink { background: #fce7f3; }
.pastel-orange { background: #ffedd5; }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

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

.modal-box {
    background: #1e293b;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--bg-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--bg-card-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Native WYSIWYG Editor */
.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: rgba(15, 23, 42, 0.8);
    padding: 8px;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.wysiwyg-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.wysiwyg-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.wysiwyg-content {
    min-height: 180px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--bg-card-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 14px;
    outline: none;
    color: var(--text-main);
}

/* File Upload Drag & Drop & Speedometer */
.dropzone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    background: rgba(99, 102, 241, 0.05);
    cursor: pointer;
    transition: var(--transition);
}

.dropzone.dragover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--secondary);
}

.speedometer-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.2s ease;
}

.speedometer-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

/* Ticket Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-card-border);
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.chat-bubble.user-bubble {
    align-self: flex-start;
    background: #312e81;
    color: #f1f5f9;
    border-bottom-right-radius: 2px;
}

.chat-bubble.admin-bubble {
    align-self: flex-end;
    background: #831843;
    color: #fce7f3;
    border-bottom-left-radius: 2px;
}

.chat-meta {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: left;
}

/* Mobile & Android Adaptive Drawer */
.mobile-fab-container {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 20px;
    z-index: 1500;
}

.fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    z-index: 1800;
    visibility: hidden;
    opacity: 0;
    transition: var(--transition);
}

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

.drawer-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-overlay.active .drawer-content {
    transform: translateY(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.drawer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
}

/* Tabs for Admin */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bg-card-border);
    padding-bottom: 10px;
}

.admin-tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.admin-tab-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Responsive Rules for Mobile/Android */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    .mobile-fab-container {
        display: block;
    }
    .app-layout {
        padding-top: 75px;
    }
}
