/* Base Styles */
body {
    background: #f8fafc;
    font-family: 'Inter', system-ui, sans-serif;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(37,99,235,0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37,99,235,0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-success:disabled {
    opacity: 0.8;
    cursor: default;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.btn-purple:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* Inputs */
.input {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    width: 100%;
    transition: all 0.15s ease;
    font-size: 14px;
    background: #fafbfc;
}

.input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.input::placeholder {
    color: #94a3b8;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* Tabs */
.tab {
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    color: #3b82f6;
}

.tab.active {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Toggle */
.toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: #e2e8f0;
    border-radius: 13px;
    cursor: pointer;
    transition: 0.2s ease;
}

.toggle.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle.active::after {
    left: 25px;
}

/* Components */
.stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
}

.account-card {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.15s ease;
}

.account-card:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.progress-bar {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

/* Responsive */
@media (max-width: 768px) {
    .tab {
        padding: 12px 14px;
        font-size: 13px;
    }
    .tab span {
        display: none;
    }
    .header-actions {
        flex-direction: column;
        gap: 12px;
    }
}


/* Modal */
#import-modal {
    backdrop-filter: blur(4px);
}


/* Sub Tabs */
.sub-tab {
    color: #64748b;
    background: transparent;
    transition: all 0.15s ease;
}

.sub-tab:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

.sub-tab.active {
    color: #3b82f6;
    background: #eff6ff;
}


/* Rich Text Editor */
.editor-wrap {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

.editor-wrap .ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc;
    padding: 10px 12px;
}

.editor-wrap .ql-container.ql-snow {
    border: none !important;
    font-family: inherit;
}

.editor-wrap .ql-editor {
    min-height: 200px;
    font-size: 14px;
    line-height: 1.6;
    padding: 16px;
}

.editor-wrap .ql-editor.ql-blank::before {
    color: #94a3b8;
    font-style: normal !important;
    left: 16px;
}

.ql-snow .ql-picker {
    color: #475569;
}

.ql-snow .ql-stroke {
    stroke: #475569;
}

.ql-snow .ql-fill {
    fill: #475569;
}

.ql-snow.ql-toolbar button:hover,
.ql-snow .ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active,
.ql-snow .ql-toolbar button.ql-active {
    color: #3b82f6;
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke {
    stroke: #3b82f6;
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill {
    fill: #3b82f6;
}

.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-label.ql-active {
    color: #3b82f6;
}

.ql-snow .ql-picker-label:hover .ql-stroke,
.ql-snow .ql-picker-label.ql-active .ql-stroke {
    stroke: #3b82f6;
}

/* Editor Mode Buttons */
.editor-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.editor-mode-btn:hover {
    color: #3b82f6;
    background: white;
}

.editor-mode-btn.active {
    color: #3b82f6;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Preview Frame */
.preview-frame {
    min-height: 250px;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
}

.preview-frame img {
    max-width: 100%;
    height: auto;
}

/* Attachments */
.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 13px;
}

.attachment-item .remove-btn {
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s;
}

.attachment-item .remove-btn:hover {
    color: #ef4444;
}


/* Email Validation States */
.input.border-green-300 {
    border-color: #86efac !important;
    background: #f0fdf4;
}

.input.border-green-300:focus {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.input.border-red-300 {
    border-color: #fca5a5 !important;
    background: #fef2f2;
}

.input.border-red-300:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}


/* Settings Grid Cards */
.settings-card {
    border: 1px solid #e5e7eb;
    transition: all 0.15s ease;
}

.settings-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}


/* Spinner Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}


/* Hide admin-only elements by default until JS determines role */
.admin-only {
    display: none;
}

body.role-admin .admin-only {
    display: inline-flex;
}

body.role-admin .admin-only.hidden {
    display: none;
}

body.role-admin div.admin-only,
body.role-admin .subtab-content.admin-only {
    display: block;
}

body.role-admin div.admin-only.hidden,
body.role-admin .subtab-content.admin-only.hidden {
    display: none;
}

/* Tabs should use flex for proper icon alignment */
body.role-admin .tab.admin-only {
    display: flex;
}
