/* =================================================================== */
/* ============== 1. GLOBAL & ROOT STYLES ============================ */
/* =================================================================== */

/* --- Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
    /* Fonts & Transitions */
    --font-sans: 'Vazirmatn', sans-serif;
    --font-mono: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
    --transition-speed: 0.3s;
}

/* --- Light Theme (Default) --- */
:root,
html[data-theme='light'] {
    --bg-color: #f4f7f9;
    --card-bg: #ffffff;
    --header-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --glow-color: rgba(59, 130, 246, 0.1);
    --btn-delete-bg: #fee2e2;
    --btn-delete-text: #b91c1c;
    --btn-delete-hover-bg: #ef4444;
    --btn-delete-hover-text: #ffffff;
}

/* --- Dark Theme --- */
html[data-theme='dark'] {
    --bg-color: #16161e;
    --card-bg: #1a1b26;
    --header-bg: #1a1b26;
    --border-color: #3b4261;
    --text-primary: #c0caf5;
    --text-secondary: #a9b1d6;
    --accent-blue: #7aa2f7;
    --accent-green: #9ece6a;
    --accent-yellow: #e0af68;
    --accent-red: #f7768e;
    --accent-purple: #bb9af7;
    --glow-color: rgba(122, 162, 247, 0.15);
    --btn-delete-bg: rgba(247, 118, 142, 0.1);
    --btn-delete-text: #f7768e;
    --btn-delete-hover-bg: #f7768e;
    --btn-delete-hover-text: #1a1b26;
}

/* --- Base & Reset --- */
* {
    margin: 0;
    padding: 0;
    /* box-sizing: border-box; */
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* --- Keyframe Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =================================================================== */
/* ============== 2. LAYOUT & SHARED COMPONENTS ====================== */
/* =================================================================== */

/* --- Main Layout --- */
.main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    /* max-width: 1800px; */
    margin: 0 auto;
    padding: 20px;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-bg);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    animation: fadeInDown 0.5s ease-out;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.header-logo {
    height: 40px;
}

html[data-theme='dark'] .header-logo {
    filter: brightness(0) invert(1);
}

.app-header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    transition: color var(--transition-speed) ease;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* --- Search Bar --- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 300px;
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.search-bar i {
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

/* --- User Profile & Dropdown --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.user-profile span {
    font-weight: 600;
}

.user-profile i {
    font-size: 2rem;
    color: var(--accent-blue);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    left: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    list-style: none;
    padding: 8px 0;
    min-width: 200px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.user-profile:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.user-dropdown a:hover {
    background-color: var(--bg-color);
}

.user-dropdown a i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.user-dropdown .divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* --- Theme Toggle Switch --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-blue);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* --- Flash Messages --- */
.flash-messages {
    margin-bottom: 20px;
    grid-column: 1 / -1;
}

.flash {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid transparent;
}

.flash-success {
    background-color: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.flash-error {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.flash-info {
    background-color: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

html[data-theme='dark'] .flash-success {
    background-color: #052e21;
    border-color: #34d399;
    color: #a7f3d0;
}

html[data-theme='dark'] .flash-error {
    background-color: #450a0a;
    border-color: #ef4444;
    color: #fecaca;
}

html[data-theme='dark'] .flash-info {
    background-color: #1e293b;
    border-color: #60a5fa;
    color: #bfdbfe;
}

/* --- General Card & Section Styles --- */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.section-title i {
    font-size: 1.8rem;
}


/* =================================================================== */
/* ============== 3. DASHBOARD PAGE STYLES =========================== */
/* =================================================================== */

.dashboard-main-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    animation: fadeInUp 0.6s 0.2s ease-out both;
}

/* --- License Card --- */
.license-card {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: all var(--transition-speed) ease;
}

.license-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.license-info i {
    font-size: 2.5rem;
    color: var(--accent-purple);
}

.license-key-wrapper h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.license-key {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background-color: var(--bg-color);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 1rem;
    direction: ltr;
    user-select: all;
}

.license-days {
    text-align: right;
}

.license-days h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.license-days .days-left {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-green);
    font-family: var(--font-mono);
}

.license-status-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    margin-left: 10px;
}

.license-status-badge.active {
    background-color: var(--accent-green);
}

.license-status-badge.inactive {
    background-color: var(--accent-red);
}


/* --- Device Cards --- */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.device-card {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

html[data-theme='dark'] .device-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: radial-gradient(circle at 50% 0%, var(--glow-color), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.device-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-blue);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

html[data-theme='dark'] .device-card:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.device-card:hover::before {
    opacity: 1;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 1;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.device-info i {
    font-size: 2.5rem;
}

.device-info h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.device-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.status.online {
    color: var(--accent-green);
}

.status.offline {
    color: var(--text-secondary);
}

.status-dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
}

.status.online .status-dot {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.status.offline .status-dot {
    background-color: var(--text-secondary);
}

.chart-wrapper {
    position: relative;
    margin: 20px 0;
    z-index: 1;
    flex-grow: 1;
}

.chart-container {
    min-height: 120px;
    height: 100%;
}

.card-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    z-index: 1;
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.alert-item i {
    font-size: 1.2rem;
}

.warning .value {
    color: var(--accent-yellow);
}

.error .value {
    color: var(--accent-red);
}

.card-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    z-index: 1;
    border-top: 1px solid var(--border-color);
    margin-top: 15px;
}

.btn-action {
    flex-grow: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.btn-details {
    background-color: var(--accent-blue);
    color: white;
}

.btn-details:hover {
    background-color: #2563eb;
}

.btn-delete {
    background-color: var(--btn-delete-bg);
    color: var(--btn-delete-text);
}

.btn-delete:hover {
    background-color: var(--btn-delete-hover-bg);
    color: var(--btn-delete-hover-text);
}

html[data-theme='dark'] .btn-details {
    background-color: var(--accent-blue);
    color: #1a1b26;
}

html[data-theme='dark'] .btn-details:hover {
    background-color: #9abef9;
}

/* --- Notifications Panel --- */
.notifications-panel {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    height: fit-content;
    margin-top: 40px;
    /* To align with section title */
}

.notifications-panel h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 25px;
}

.timeline {
    list-style: none;
    padding-right: 25px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 4px;
    bottom: 5px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-icon {
    position: absolute;
    right: -25px;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
}

.timeline-item.error .timeline-icon {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.timeline-item.warning .timeline-icon {
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

.timeline-item.info .timeline-icon {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.timeline-content {
    padding-top: 5px;
}

.timeline-content p {
    margin: 0;
    font-weight: 500;
    font-size: 0.95rem;
}

.timeline-content small {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}


/* =================================================================== */
/* ============== 4. LOGIN & REGISTER PAGE STYLES ==================== */
/* =================================================================== */

/* Add this class to the <body> tag on the login/register page */
body.login-page {
    overflow: hidden;
    /* Use a different variable set if needed, otherwise defaults are fine */
    --background-color: var(--bg-color);
    --text-color: var(--text-primary);
    --text-muted-color: var(--text-secondary);
    --primary-color: var(--accent-blue);
    --secondary-color: var(--accent-purple);
    --primary-color-rgb: 59, 130, 246;
    /* For RGBA box-shadow */
    --hover-color: var(--glow-color);
}

.split-screen-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* --- Branding Pane (Right Side) --- */
.branding-pane {
    width: 50%;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    background-image:
        linear-gradient(rgba(19, 41, 75, 0.85), rgba(30, 64, 115, 0.95)),
        url('../images/background-image.jpg');
    /* Placeholder */
    background-size: cover;
    background-position: center;
}

.branding-content {
    max-width: 450px;
    animation: fadeIn 1.5s ease-in-out;
}

.branding-logo {
    max-width: 150px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.branding-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.branding-content p {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
}

.login-title {
color: white;
}

/* --- Form Pane (Left Side) --- */
.form-pane {
    width: 80%;
    display: grid;
    justify-content: center;
    align-items: center;
    background-color: var(--background-color);
    padding: 40px;
    overflow-y: auto;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 400px;
    animation: slideInFromLeft 1s ease-out;
}

.auth-header {
    margin-bottom: 2rem;
    text-align: center;
}

.auth-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-color);
}

.auth-header p {
    color: var(--text-muted-color);
    margin-top: 0.5rem;
}

/* --- Account Type Selector (Register Page) --- */
.account-type-selector {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 40px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.selector-btn {
    flex: 1;
    padding: 12px 15px;
    background-color: transparent;
    border: none;
    color: var(--text-muted-color);
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.selector-btn.active {
    background-color: #003366;
    color: #ff6633;
    box-shadow: 0 2px 10px rgba(var(--primary-color-rgb), 0.3);
}

.selector-btn:not(.active):hover {
    background-color: var(--hover-color);
}

/* --- Form Inputs with Floating Labels --- */
.form-container .input-box {
    position: relative;
    margin: 30px 0;
}

.input-box input {
    width: 100%;
    height: 50px;
    background: transparent;
    border: none;
    outline: none;
    border-bottom: 2px solid var(--border-color);
    font-size: 1em;
    color: var(--text-color);
    padding: 0 5px;
    transition: border-color 0.3s ease;
}

.input-box label {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    color: var(--text-muted-color);
    font-size: 1em;
    pointer-events: none;
    transition: .3s ease-out;
}

/* Floating label animation */
.input-box input:focus~label,
.input-box input:not(:placeholder-shown)~label {
    top: -5px;
    font-size: 0.8em;
    color: var(--primary-color);
}

.input-box input:focus {
    border-bottom-color: var(--primary-color);
}

.input-box i {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted-color);
    transition: color 0.3s ease;
}

.input-box input:focus~i {
    color: var(--primary-color);
}

.remember-forgot {
    font-size: .9em;
}

/* Helper class */
.hidden {
    display: none;
}


/* =================================================================== */
/* ============== 5. DEVICE DETAIL PAGE STYLES ======================= */
/* =================================================================== */

.details-page-container {
    animation: fadeInUp 0.5s ease-out;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.details-header .header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.details-header .header-icon {
    font-size: 2.5rem;
    color: var(--accent-blue);
}

.details-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* --- Grid Layout --- */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.grid-col-span-2 {
    grid-column: span 2;
}

.grid-col-span-full {
    grid-column: 1 / -1;
}

/* --- Card Styling --- */
.details-grid .card {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 25px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

html[data-theme='dark'] .details-grid .card {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.card-header i {
    font-size: 1.6rem;
    color: var(--text-secondary);
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Chart Container (Bugfix) --- */
.details-grid .chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    flex-grow: 1;
}

/* --- Info Card --- */
.info-card {
    background: linear-gradient(135deg, var(--card-bg), var(--bg-color));
}

.info-card .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-card .info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-card .info-item strong {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.info-card .info-item span {
    font-weight: 600;
    font-size: 1.1rem;
}

.info-card .info-item.full-width {
    grid-column: 1 / -1;
}


/* =================================================================== */
/* ============== 6. SETTINGS PAGE STYLES ============================ */
/* =================================================================== */

.settings-page-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: flex-start;
    animation: fadeInUp 0.5s ease-out;
}

/* --- Sidebar --- */
.settings-sidebar {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
}

.settings-sidebar h3 {
    font-size: 1.3rem;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.settings-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.settings-menu li a:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.settings-menu li.active a {
    background-color: var(--accent-blue);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

html[data-theme='dark'] .settings-menu li.active a {
    color: var(--card-bg);
}

.settings-menu li a i {
    font-size: 1.4rem;
}

/* --- Content Area --- */
.settings-content .form-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

.info-box {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent-blue);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

html[data-theme='dark'] .info-box {
    background-color: rgba(122, 162, 247, 0.1);
    border-color: rgba(122, 162, 247, 0.2);
    border-left-color: var(--accent-blue);
}

.info-box i {
    font-size: 1.8rem;
    color: var(--accent-blue);
    margin-top: 2px;
}

.info-box p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.info-box p strong {
    color: var(--text-primary);
}


/* =================================================================== */
/* ============== 7. REUSABLE FORMS, TABLES, BUTTONS ================= */
/* =================================================================== */

/* --- Modern Form Styles --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}


.form-group input[type="text"],
.form-group input[type="search"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--glow-color);
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-with-unit span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-form-inline {
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

.firewall-form .form-actions {
    display: flex;
    gap: 10px;
}

.grid-full-width {
    grid-column: 1 / -1;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary-full {
    /* For Login Page */
    width: 100%;
    height: 45px;
    border-radius: 40px;
    font-size: 1.1em;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

html[data-theme='dark'] .btn-primary {
    color: #1a1b26;
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background-color: #1e8449;
}

.btn-link {
    background: none;
    color: var(--accent-blue);
    padding: 0;
}

/* --- Modern Table Styles --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table thead th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: var(--glow-color);
}

.data-table .text-center {
    text-align: center;
}

/* --- Table Controls (Filters, Row Limit) --- */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.table-controls.single-control {
    justify-content: flex-end;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 0;
}

.row-limiter-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-limiter-wrapper label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.row-limiter-wrapper select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.row-limiter-wrapper select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--glow-color);
}

.hidden-row {
    display: none;
}


/* =================================================================== */
/* ============== 8. RESPONSIVE DESIGN =============================== */
/* =================================================================== */

@media (max-width: 1400px) {

    /* Dashboard */
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {

    /* Device Details */
    .details-grid {
        grid-template-columns: 1fr;
    }

    .grid-col-span-2 {
        grid-column: span 1;
    }

    .settings-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {

    /* Header */
    .app-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .search-bar {
        width: 100%;
    }

    /* Settings Page */
    .settings-page-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body:not(.login-page) {
        padding: 2px;
    }

    /* Dashboard */
    .devices-grid {
        grid-template-columns: 1fr;
    }

    .license-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .license-days {
        text-align: center;
    }

    /* Login Page */
    .split-screen-container {
        flex-direction: column;
    }

    .form-pane,
    .branding-pane {
        width: 100%;
    }

    .branding-pane {
        height: 35vh;
        order: -1;
    }

    .form-pane {
        height: 65vh;
    }
}


/* ======================================================== */
/* =========== STYLES FOR REFACTORED DASHBOARD ============ */
/* ======================================================== */

/* General Summary & Action Cards */
.summary-card,
.action-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    /* Consistent spacing */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.action-card {
    background: var(--glow-color);
}

.action-card-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-card-content h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.action-card-content p {
    color: var(--text-secondary);
    margin: 0;
}

/* Trial License Card */
.trial-card {
    background-color: var(--accent-blue);
    color: white;
    border-color: transparent;
}

.trial-card h3 {
    color: white;
}

.trial-card p {
    color: #e0e0e0;
    font-size: 0.9rem;
}

.trial-card .btn-trial-upgrade {
    background-color: white;
    color: var(--accent-blue);
    font-weight: bold;
}

/* License Details Card */
.license-details-card .license-stat {
    text-align: right;
}

.license-details-card .license-stat h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.license-details-card .days-left {
    font-size: 1.2rem;
    font-weight: 700;
}

.license-details-card .device-count,
.license-details-card .data-retention {
    font-size: 1.5rem;
}

.license-details-card .data-retention {
    color: var(--accent-purple);
}

.status-active {
    color: var(--accent-green);
}

.status-inactive {
    color: var(--accent-red);
}


/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 992px) {
    .actions-grid {
        grid-template-columns: 1fr;
    }
}

/* Icons Colors */
.icon-blue {
    color: var(--accent-blue);
    font-size: 2rem;
}

.icon-green {
    color: var(--accent-green);
    font-size: 2rem;
}

.icon-orange {
    color: #E95420;
}

.icon-secondary {
    color: var(--text-secondary);
}

/* Placeholder Card (for macOS) */
.placeholder-card {
    text-align: center;
    padding: 3rem;
    background-color: var(--bg-color);
    border: 2px dashed var(--border-color);
    opacity: 0.8;
    border-radius: 12px;
}

.placeholder-card i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.placeholder-card h3 {
    color: var(--text-primary);
}

.placeholder-card p {
    color: var(--text-secondary);
    max-width: 450px;
    margin: 0.5rem auto 0;
}

.empty-state-message {
    color: var(--text-secondary);
    padding: 1rem 0;
}


/* Styling for multiple download buttons in action cards */
.action-card-buttons {
    display: flex;
    gap: 0.75rem;
    /* فاصله بین دکمه‌ها */
    flex-wrap: wrap;
    /* در صفحات کوچک‌تر، دکمه‌ها زیر هم می‌روند */
}

/* Style for disabled/coming-soon buttons */
.btn.disabled {
    background-color: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    pointer-events: none;
    /* کلیک کردن را غیرممکن می‌کند */
    opacity: 0.7;
}

.btn.disabled:hover {
    transform: none;
    /* حذف افکت هاور */
    box-shadow: none;
}


/* ======================================================== */
/* ========= STYLES FOR ADVANCED DASHBOARD WIDGETS ======== */
/* ======================================================== */

/* --- Grids for new layout --- */
.dashboard-summary-grid,
.dashboard-mid-section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {

    .dashboard-summary-grid,
    .dashboard-mid-section-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Security Score Card --- */
.security-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.score-circle {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.score-circle .score-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-circle .score-text sup {
    font-size: 1.2rem;
    font-weight: 500;
}

.score-details {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.score-details ul {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

/* --- Quick Actions on Device Cards --- */
.card-actions {
    position: relative;
    /* برای موقعیت‌دهی منوی کشویی */
}

.quick-actions-dropdown {
    display: none;
    /* مخفی به صورت پیش‌فرض */
    position: absolute;
    bottom: 100%;
    /* باز شدن به سمت بالا */
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    width: 180px;
    overflow: hidden;
    margin-bottom: 5px;
}

.quick-actions-dropdown.show {
    display: block;
}

.quick-actions-dropdown form {
    display: block;
}

.quick-actions-dropdown .btn-action-menu {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    text-align: right;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.quick-actions-dropdown .btn-action-menu:hover {
    background-color: var(--bg-color);
}

/* --- Risky Devices & Global Commands --- */
.risky-devices-list,
.global-commands-list {
    list-style: none;
    padding: 0;
}

.risky-devices-list li,
.global-commands-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.risky-devices-list li:last-child,
.global-commands-list li:last-child {
    border-bottom: none;
}

.risky-device-name a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.risky-device-name a:hover {
    color: var(--accent-blue);
}

.alert-count-badge {
    background-color: var(--btn-delete-bg);
    color: var(--btn-delete-text);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* --- Achievement/Tip Card --- */
.achievement-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
}

.achievement-card.achievement {
    border-left: 5px solid var(--accent-green);
}

.achievement-card.tip {
    border-left: 5px solid var(--accent-yellow);
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.achievement-content i {
    font-size: 2rem;
}

.achievement-card.achievement i {
    color: var(--accent-green);
}

.achievement-card.tip i {
    color: var(--accent-yellow);
}

.achievement-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* ======================================================== */
/* ========= STYLES FOR ENHANCED SECURITY SCORE WIDGET ==== */
/* ======================================================== */

.security-score-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    /* ستون برای نمودار و ستون برای توضیحات */
    align-items: center;
    gap: 2rem;
}

.score-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-circle {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.5s ease;
}

/* رنگ‌بندی پویا برای نمودار دایره‌ای */
.score-circle.green {
    background: conic-gradient(var(--accent-green) var(--score, 0deg), var(--border-color) 0deg);
}

.score-circle.yellow {
    background: conic-gradient(var(--accent-yellow) var(--score, 0deg), var(--border-color) 0deg);
}

.score-circle.red {
    background: conic-gradient(var(--accent-red) var(--score, 0deg), var(--border-color) 0deg);
}

.score-circle-inner {
    width: 120px;
    height: 120px;
    background-color: var(--card-bg);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-text sup {
    font-size: 1.2rem;
    font-weight: 500;
}

.score-status-text {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-green {
    color: var(--accent-green);
}

.status-yellow {
    color: var(--accent-yellow);
}

.status-red {
    color: var(--accent-red);
}

.score-recommendations h4 {
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.recommendation-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.recommendation-item i {
    font-size: 1.2rem;
    color: var(--accent-yellow);
}





/* In: app/templates/device_detail.html (inside the <style> tag) */

/* --- Table Controls (Filters, Row Limit) --- */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 0;
}

/* --- استایل جدید برای کنترل‌های جدول فرآیندها --- */
.table-controls .filter-form {
    display: flex;
    /* آیتم‌ها را در یک ردیف قرار می‌دهد */
    flex-wrap: wrap;
    /* در صفحات کوچک، آیتم‌ها زیر هم می‌روند */
    align-items: flex-end;
    /* آیتم‌ها را از پایین تراز می‌کند */
    gap: 1.5rem;
    /* فاصله بین هر آیتم */
}

/* استایل برای هر گروه از فرم (لیبل + اینپوت) */
.table-controls .filter-form .form-group {
    margin-bottom: 0;
    /* حذف فاصله پایین اضافی */
}

/* در صفحات کوچک‌تر، هر آیتم تمام عرض را اشغال کند */
@media (max-width: 768px) {
    .table-controls .filter-form {
        flex-direction: column;
        /* آیتم‌ها را زیر هم قرار می‌دهد */
        align-items: stretch;
        /* آیتم‌ها را از نظر عرضی کش می‌دهد */
        gap: 1rem;
    }
}


/* اصلاح چیدمان فرم‌های فیلتر */
.filter-form {
    display: flex;
    flex-wrap: wrap; /* اجازه می‌دهد در صفحه‌های کوچک، آیتم‌ها زیر هم بروند */
    align-items: flex-end; /* آیتم‌ها را از پایین تراز می‌کند */
    gap: 1.5rem; /* فاصله بین آیتم‌ها */
    margin-bottom: 1rem;
}

.filter-form .form-group {
    width: auto; /* عرض صددرصدی پیش‌فرض را لغو می‌کند */
    flex-grow: 1; /* به آیتم‌ها اجازه می‌دهد فضای موجود را به تساوی تقسیم کنند */
    min-width: 180px; /* حداقل عرض برای هر فیلتر برای جلوگیری از کوچک شدن بیش از حد */
}

.filter-form .form-actions {
    flex-grow: 0; /* دکمه‌ها فضای اضافی را اشغال نکنند */
}






/* =================================================================== */
/* ============== 8. RESPONSIVE OVERRIDES (FINAL FIX) ============== */
/* =================================================================== */

/* 
 * یک قانون کلی برای جلوگیری از هرگونه سرریز شدن افقی در کل سایت.
*/
body {
    overflow-x: hidden;
}
.main-layout {
    /* width: 100%; */
    max-width: 100%; /* اطمینان از اینکه کانتینر اصلی از صفحه بیرون نمی‌زند */
}


/* --- برای تبلت‌ها (عرض کمتر از 1024 پیکسل) --- */
@media (max-width: 1024px) {
    /* 
     * مهم‌ترین تغییر: چیدمان اصلی صفحه جزئیات و تنظیمات را به تک ستونی تبدیل می‌کند.
    */
    .settings-page-layout {
        grid-template-columns: 1fr !important; /* ستون‌ها را یکی می‌کند */
    }

    .settings-sidebar {
        width: 100%; /* ستون کناری تمام عرض را اشغال می‌کند */
        margin-bottom: 2rem; /* ایجاد فاصله با محتوای پایینی */
    }

    .details-grid {
        /* در تبلت، کارت‌های اطلاعاتی می‌توانند دو ستونی باقی بمانند */
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* --- برای موبایل (عرض کمتر از 768 پیکسل) --- */
@media (max-width: 430px) {
    /* کاهش فاصله‌های اضافی در کل صفحه */
    .main-layout {
        padding: 10px;
    }

    .card, .table-wrapper {
        padding: 15px; /* کاهش padding داخلی کارت‌ها */
    }
    
    /* هدر صفحه جزئیات: چیدمان عمودی و کاهش اندازه فونت */
    .details-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    .details-header h1 {
        font-size: 1.4rem; /* کاهش اندازه عنوان برای موبایل */
    }

    /* تک ستونی کردن تمام گریدها در موبایل */
    .details-grid,
    .settings-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* بهبود ظاهر فرم‌ها در موبایل */
    .settings-form-inline,
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-form-inline .btn,
    .filter-form .btn {
        width: 100%;
        justify-content: center;
    }
    
    .filter-form .form-actions {
        flex-direction: row;
        width: 100%;
    }
    .filter-form .form-actions .btn {
        flex-grow: 1; /* دکمه‌ها فضای مساوی بگیرند */
    }

    /* تنظیمات اختصاصی برای کارت اطلاعات سیستم در موبایل */
    .info-grid {
        grid-template-columns: 1fr !important;
    }
    .info-item {
        flex-direction: row !important; /* بازگرداندن به حالت افقی برای خوانایی بهتر */
        justify-content: space-between;
        align-items: center !important;
    }
    
    /* رفع مشکل جدول فرآیندها در موبایل */
    .table-responsive {
        overflow-x: auto; /* این اطمینان می‌دهد که جداول عریض باعث اسکرول کل صفحه نشوند */
    }
}







.card-tickets {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-tickets:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header-tickets {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-bottom: none;
}

.card-header-tickets h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-tickets i {
    font-size: 1.75rem;
}


.form-group-tickets {
    margin-bottom: 1.5rem;
}


.form-control-tickets {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.form-control-tickets:focus {
    outline: none;
    border-color: #667eea;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control-tickets:hover {
    border-color: #9ca3af;
}

select.form-control-tickets {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em;
    padding-right: 3rem;
}

textarea.form-control-tickets {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

input[type="file"].form-control-tickets {
    padding: 0.5rem;
    background-color: transparent;
    border: 2px dashed #d1d5db;
}

input[type="file"].form-control-tickets:hover {
    border-color: #9ca3af;
    background-color: #f9fafb;
}

small.text-secondary {
    display: block;
    margin-top: 0.5rem;
    color: #6b7280;
    font-size: 0.8rem;
}

.btn-t {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary-t {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary-t:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary-t:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .main-layout-tickets {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .card-header-tickets {
        padding: 1.25rem 1.5rem;
    }
    
    form {
        padding: 1.5rem;
    }
    
    .card-header-tickets h2 {
        font-size: 1.25rem;
    }
}




.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.table-wrapper {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    overflow: hidden;
}


.ticket-meta {
    display: flex;
    gap: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.chat-container-tickets {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.chat-bubble {
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    max-width: 70%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: transform 0.2s ease;
}

.chat-bubble:hover {
    transform: translateY(-2px);
}

.user-reply {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.admin-reply {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1f2937;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-bubble p {
    margin: 0 0 1rem 0;
    line-height: 1.6;
    font-size: 1rem;
}

.chat-bubble small {
    opacity: 0.9;
    font-size: 0.85rem;
}

.attachments-tickets {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 1rem;
}

.admin-reply .attachments-tickets {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.attachments-tickets strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.attachments-tickets ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.attachments-tickets li {
    margin-bottom: 0.5rem;
}

.attachments-tickets a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.attachments-tickets a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
}

.admin-reply .attachments-tickets a {
    background: #f8fafc;
    color: #374151;
}

.admin-reply .attachments a:hover {
    background: #e2e8f0;
}

hr {
    margin: 3rem 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

form {
    border-radius: 16px;
}

h4 {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    background: #ffffff;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group-tickets {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.btn-primary-t {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-t:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

@media (max-width: 768px) {
    .admin-container {
        padding: 0 0.5rem;
    }
    
    .table-wrapper {
        padding: 1.5rem;
    }
    
    .chat-bubble {
        max-width: 85%;
        padding: 1rem 1.25rem;
    }
    
    .ticket-meta {
        flex-direction: column;
        gap: 1rem;
    }
    
    form {
        padding: 1.5rem;
    }
}
