/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    /* Brand Colors */
    --brand-red: #E74C3C;
    --brand-red-hover: #C0392B;
    --brand-red-light: rgba(231, 76, 60, 0.1);
    --brand-purple: #6B46C1;
    --brand-purple-hover: #553C9A;
    --brand-purple-light: rgba(107, 70, 193, 0.1);
    --brand-gold: #D4AF37;
    --brand-gold-light: rgba(212, 175, 55, 0.15);
    
    /* Primary uses purple for main actions */
    --primary-color: #6B46C1;
    --primary-hover: #553C9A;
    
    /* UI Colors */
    --sidebar-bg: #FAFAFA;
    --content-bg: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --transition-speed: 0.2s;
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden; /* App-like feel */
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    height: 100%;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 12px 24px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-purple));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(107, 70, 193, 0.25);
}

.app-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 24px 12px 8px 12px;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--brand-purple-light), var(--brand-red-light));
    color: var(--brand-purple);
    font-weight: 600;
    border-left: 3px solid var(--brand-purple);
    margin-left: -3px;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    opacity: 0.8;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--content-bg);
    position: relative;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: #F2F2F7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Dashboard Content */
.content-container {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 40px;
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-purple));
    border-radius: 16px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 25px rgba(107, 70, 193, 0.3);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 16px;
    text-align: left;
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 12px;
    background: #F2F2F7;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    background: white;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px var(--brand-purple-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px; /* Slightly rounded, not full pill */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-hover));
    color: white;
    box-shadow: 0 2px 8px rgba(107, 70, 193, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-purple-hover), var(--brand-purple));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, var(--brand-red), var(--brand-red-hover));
    color: white;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--brand-red-hover), var(--brand-red));
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background-color: #F3F4F6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #E5E7EB;
    border-color: #D1D5DB;
}

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

.btn-danger:hover {
    background: linear-gradient(135deg, #DC2626, var(--danger-color));
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--brand-gold), #B8962E);
    color: white;
}

/* Tabs */
.content-tabs {
    border-bottom: 1px solid var(--border-color);
}

.content-tabs .btn-secondary {
    border-radius: 999px;
    padding-inline: 16px;
}

.content-tabs .btn-secondary.active {
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-red));
    color: #fff;
    border-color: transparent;
}

.tab-content {
    display: none;
}

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

/* Cards & Grid */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.2s;
}

.card:hover {
    border-color: #d1d1d6;
    box-shadow: var(--card-shadow);
    transform: translateY(-2px);
}

/* Prayer / banner item cards */
.item-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.item-image {
    width: 100%;
    height: 260px; /* fixed, uniform height */
    object-fit: cover; /* crop to fill without distortion */
    display: block;
}

.item-content {
    padding: 16px 20px 18px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

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

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

.section-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 15px;
}

/* Items List */
.items-list {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.list-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    transition: background 0.1s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: #F9F9F9;
}

.item-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

/* Tags */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tag-purple { background: var(--brand-purple-light); color: var(--brand-purple); }
.tag-red { background: var(--brand-red-light); color: var(--brand-red); }
.tag-gold { background: var(--brand-gold-light); color: #96780C; }
.tag-green { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.tag-blue { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }
.tag-orange { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--brand-purple-light);
    border-top-color: var(--brand-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Modal */
#modalContainer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    pointer-events: none;
    display: block !important;
}

#modalContainer:not(:empty) {
    pointer-events: auto !important;
}

.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(5px);
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: fadeIn 0.2s ease;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2); /* Lighter overlay */
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative !important;
    background: white !important;
    width: 90% !important;
    max-width: 550px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    padding: 32px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100000 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

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

.modal-close,
.close-btn {
    background: #F2F2F7;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 24px;
    line-height: 1;
}

.modal-close:hover,
.close-btn:hover {
    background: #E5E5EA;
    color: var(--text-primary);
}

/* Form Elements inside Modal */
.form-group {
    margin-bottom: 20px;
}

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

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px var(--brand-purple-light);
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-area:hover {
    border-color: var(--brand-purple);
    background-color: var(--brand-purple-light);
}

/* Error/Success */
.error-message {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 13px;
    text-align: center;
}

/* Section Visibility */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.content-section.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* Support for dynamically generated inputs in modals */
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="number"],
.modal-content input[type="url"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.2s;
    background-color: white;
    margin-top: 4px;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px var(--brand-purple-light);
}

.modal-content label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Featured Badge */
.featured-badge {
    background: linear-gradient(135deg, var(--brand-gold), #B8962E);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Section Header Enhancement */
.section-header h2 {
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Hover Enhancement */
.card {
    border-left: 3px solid transparent;
}

.card:hover {
    border-left-color: var(--brand-purple);
}

/* Icon Button Enhancement */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--brand-purple-light);
    color: var(--brand-purple);
}

/* ===== SLIDE PANEL ===== */
.slide-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    transform: translateX(100%);
    visibility: hidden;
}

.slide-panel.active {
    transform: translateX(0);
    visibility: visible;
}

.slide-panel.large {
    width: 700px;
}

.slide-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--brand-purple-light), var(--brand-red-light));
}

.slide-panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.slide-panel-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.slide-panel-close:hover {
    background: var(--brand-red-light);
    color: var(--brand-red);
    transform: scale(1.05);
}

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

.slide-panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #FAFAFA;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Form Sections in Slide Panel */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-purple);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Two Column Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .slide-panel {
        width: 100vw;
        max-width: 100vw;
    }
}

/* Current Image Display */
.current-image-display {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.current-image-display img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.current-image-info {
    flex: 1;
}

.current-image-info .status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--success-color);
    font-size: 13px;
    font-weight: 500;
}

/* Quill editor in slide panel */
.slide-panel .ql-container {
    min-height: 250px;
}

.slide-panel .ql-editor {
    min-height: 250px;
}

/* ===== MULTI-TENANT STYLES ===== */

/* Super Admin Badge */
.super-admin-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tenant Selector */
.tenant-selector {
    margin: 0 8px 16px 8px;
    position: relative;
}

.tenant-selector-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tenant-selector-current:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border-color: rgba(99, 102, 241, 0.3);
}

.tenant-selector-current span {
    font-size: 13px;
    font-weight: 500;
    color: #4f46e5;
}

/* Tenant Dropdown */
.tenant-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    max-height: 300px;
    overflow-y: auto;
}

.tenant-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tenant-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tenant-option:first-child {
    border-radius: 8px 8px 0 0;
}

.tenant-option:last-child {
    border-radius: 0 0 8px 8px;
}

.tenant-option:hover {
    background: #f3f4f6;
}

.tenant-option.active {
    background: rgba(99, 102, 241, 0.1);
}

.tenant-option.active .tenant-name {
    color: #4f46e5;
    font-weight: 500;
}

.tenant-name {
    font-size: 13px;
    color: var(--text-primary);
}

.tenant-badge {
    font-size: 10px;
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.tenant-option.tenant-add {
    border-top: 1px solid var(--border-color);
    color: #6366f1;
    font-weight: 500;
}

.tenant-option.tenant-add span {
    color: #6366f1;
}

/* Tenant Card for Tenant Management */
.tenant-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.tenant-card:hover {
    box-shadow: var(--card-shadow);
    border-color: rgba(99, 102, 241, 0.3);
}

.tenant-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tenant-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tenant-card-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

.tenant-card-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.module-tag {
    font-size: 11px;
    background: #f3f4f6;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.module-tag.enabled {
    background: #dcfce7;
    color: #166534;
}

/* Super Admin Email Tag */
.super-admin-email-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    margin-right: 8px;
}

.super-admin-email-tag span {
    font-size: 13px;
    color: var(--text-primary);
}

.super-admin-email-tag button {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.super-admin-email-tag button:hover {
    color: #dc2626;
}

/* ===== Support Ticket Styles ===== */
.priority-critical {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #ef4444;
}

.priority-high {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-left: 4px solid #f97316;
}

.priority-medium {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
}

.priority-low {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid #22c55e;
}

.ticket-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #ccc;
    transition: all 0.2s ease;
}

.ticket-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ticket-card.critical { border-left-color: #ef4444; }
.ticket-card.high { border-left-color: #f97316; }
.ticket-card.medium { border-left-color: #f59e0b; }
.ticket-card.low { border-left-color: #22c55e; }

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.ticket-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.ticket-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ticket-tenant {
    background: #e0e7ff;
    color: #4f46e5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.ticket-type {
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.ticket-priority {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.ticket-priority.critical { background: #fef2f2; color: #dc2626; }
.ticket-priority.high { background: #fff7ed; color: #ea580c; }
.ticket-priority.medium { background: #fefce8; color: #ca8a04; }
.ticket-priority.low { background: #f0fdf4; color: #16a34a; }

.ticket-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.ticket-status.open { background: #fef3c7; color: #92400e; }
.ticket-status.in_progress { background: #dbeafe; color: #1d4ed8; }
.ticket-status.resolved { background: #d1fae5; color: #065f46; }
.ticket-status.closed { background: #f3f4f6; color: #6b7280; }

.ticket-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.ticket-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.ticket-sla {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f3f4f6;
}

.ticket-sla.overdue {
    background: #fef2f2;
    color: #dc2626;
}

.ticket-sla.warning {
    background: #fefce8;
    color: #ca8a04;
}

.nav-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Ticket Response Thread */
.ticket-responses {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.response-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.response-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.response-avatar.admin {
    background: #6366f1;
}

.response-content {
    flex: 1;
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
}

.response-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
}

.response-author {
    font-weight: 600;
    color: var(--text-primary);
}

.response-time {
    color: var(--text-secondary);
}

.response-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Preview Client Dropdown */
#previewClientSelect {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

#previewClientSelect option {
    background: #1e1e3f;
    color: #fff;
    padding: 8px;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* Tablet Breakpoint (768px - 1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .content-container {
        padding: 24px;
    }
    
    .grid-3 {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        padding: 16px 24px;
    }
    
    .page-title {
        font-size: 20px;
    }
}

/* Mobile Breakpoint (768px and below) */
@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Show sidebar overlay */
    .sidebar-overlay {
        display: block;
    }
    
    /* Sidebar becomes slide-out drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }
    
    /* Main content takes full width */
    .main-content {
        width: 100%;
        margin-left: 0;
    }
    
    /* Top bar adjustments */
    .top-bar {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .page-title {
        font-size: 18px;
        flex: 1;
        text-align: center;
    }
    
    .user-profile {
        gap: 8px;
    }
    
    .user-profile span {
        display: none;
    }
    
    /* Content container */
    .content-container {
        padding: 16px;
    }
    
    /* Grid layouts */
    .grid-3, .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Section headers */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-header > div:first-child {
        width: 100%;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    .section-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Cards */
    .card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    /* Item cards */
    .item-image {
        height: 200px;
    }
    
    .item-content {
        padding: 12px 16px 14px;
    }
    
    /* List items */
    .list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }
    
    .item-info {
        width: 100%;
    }
    
    .list-item .item-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }
    
    .list-item .item-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* Quick actions on overview */
    .content-section#overview > div:last-child {
        flex-direction: column;
    }
    
    .content-section#overview > div:last-child .btn {
        width: 100%;
    }
    
    /* Modals */
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        max-height: 85vh !important;
        padding: 20px !important;
        border-radius: 16px !important;
        margin: 16px;
    }
    
    .modal-header {
        margin-bottom: 16px;
    }
    
    .modal-header h2, .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Slide panels become full screen */
    .slide-panel {
        width: 100vw;
        max-width: 100vw;
    }
    
    .slide-panel-header {
        padding: 16px;
    }
    
    .slide-panel-body {
        padding: 16px;
    }
    
    .slide-panel-footer {
        padding: 12px 16px;
        flex-direction: column;
    }
    
    .slide-panel-footer .btn {
        width: 100%;
    }
    
    /* Form elements */
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-input, .form-select, .form-textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Channels section */
    .channels-form .grid-2 {
        grid-template-columns: 1fr;
    }
    
    /* Tenant selector */
    .tenant-selector {
        margin: 0 4px 12px 4px;
    }
    
    .tenant-selector-current {
        padding: 8px 10px;
    }
    
    /* Login screen */
    .login-card {
        padding: 24px;
        margin: 16px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    .login-subtitle {
        font-size: 14px;
    }
    
    /* Tabs */
    .content-tabs {
        flex-wrap: wrap;
    }
    
    .content-tabs .btn-secondary {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    /* Navigation menu */
    .nav-section-label {
        margin: 16px 8px 6px 8px;
        font-size: 10px;
    }
    
    .nav-item {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Sidebar header */
    .sidebar-header {
        padding: 0 8px 16px 8px;
    }
    
    /* Info cards */
    .info-card,
    [style*="background: linear-gradient"] {
        padding: 12px !important;
    }
    
    /* Quill editor */
    .ql-editor {
        min-height: 150px;
    }
    
    /* File upload */
    .file-upload-area {
        padding: 20px;
    }
    
    /* Ticket cards */
    .ticket-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .ticket-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .ticket-actions {
        flex-wrap: wrap;
    }
    
    .ticket-actions .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Small Mobile Breakpoint (480px and below) */
@media (max-width: 480px) {
    .content-container {
        padding: 12px;
    }
    
    .top-bar {
        padding: 10px 12px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .section-header h2 {
        font-size: 18px;
    }
    
    .card {
        padding: 14px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .modal-content {
        padding: 16px !important;
        margin: 8px;
        max-height: 90vh !important;
    }
    
    .login-card {
        padding: 20px;
    }
    
    .login-title {
        font-size: 18px;
    }
    
    /* Navigation items smaller */
    .nav-item {
        padding: 10px;
        font-size: 13px;
    }
    
    .nav-item svg {
        width: 16px;
        height: 16px;
        margin-right: 10px;
    }
    
    /* Tags */
    .tag {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    /* List items */
    .list-item {
        padding: 12px;
    }
    
    .item-info h3 {
        font-size: 14px;
    }
    
    .item-info p {
        font-size: 12px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 80vh !important;
    }
    
    .slide-panel {
        width: 60vw;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }
    
    .nav-item {
        min-height: 44px;
    }
    
    .form-input, .form-select {
        min-height: 44px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
}
