/**
 * Shukran CRM Admin Styles
 */

/* Settings Page Layout */
.settings-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

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

.settings-header h1 {
    margin: 0;
    font-size: 28px;
    color: #1e293b;
    font-weight: 600;
}

.settings-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 14px;
}

.btn-primary {
    background: #00b8a9;
    color: white;
}

.btn-primary:hover {
    background: #009688;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 184, 169, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: #64748b;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #00b8a9;
}

.btn-icon .material-icons {
    font-size: 20px;
}

/* Tables */
.crm-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.crm-table thead {
    background: #f8fafc;
}

.crm-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.crm-table tbody tr:hover {
    background: #f8fafc;
}

.crm-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: #e0f7f4;
    color: #00b8a9;
    margin-right: 4px;
}

.badge-super {
    background: #fef3c7;
    color: #d97706;
}

.badge-gray {
    background: #f1f5f9;
    color: #64748b;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #dcfce7;
    color: #16a34a;
}

.status-disabled {
    background: #fee2e2;
    color: #dc2626;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #00b8a9;
    box-shadow: 0 0 0 3px rgba(0, 184, 169, 0.1);
}

.form-control:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

/* Success Message */
.success-message {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .settings-page {
        padding: 12px;
    }
    
    .settings-content {
        padding: 20px;
    }
    
    .crm-table {
        font-size: 13px;
    }
    
    .crm-table th,
    .crm-table td {
        padding: 8px 12px;
    }
}

/* Permissions Matrix Styles */
.permissions-matrix-container { max-width: 1200px; margin: 0 auto; }
.permissions-header { margin-bottom: 30px; }
.permissions-table { width: 100%; border-collapse: collapse; background: white; }
.permissions-table th { background: #f8fafc; padding: 12px; text-align: left; font-weight: 600; border: 1px solid #e2e8f0; font-size: 13px; }
.permissions-table td { padding: 12px; border: 1px solid #e2e8f0; }
.permissions-table tbody tr:hover { background: #f8fafc; }
.permission-checkbox { cursor: pointer; width: 18px; height: 18px; }
.select-module { cursor: pointer; }

/* Disabled User Page Styles */
.disabled-page-container {
    font-family: -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.disabled-page-card {
    background: white;
    border-radius: 12px;
    padding: 60px 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.disabled-page-icon {
    font-size: 80px;
    margin-bottom: 20px;
}
.disabled-page-card h1 {
    color: #dc2626;
    font-size: 32px;
    margin: 0 0 16px 0;
}
.disabled-page-card p {
    color: #64748b;
    font-size: 18px;
    margin: 0 0 32px 0;
    line-height: 1.6;
}
.disabled-page-btn {
    display: inline-block;
    background: #00b8a9;
    color: white;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

/* Permissions Footer */
.permissions-footer {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

/* Access Denied Page */
.access-denied-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0; padding: 0; height: 100vh;
    display: flex; align-items: center; justify-content: center;
}
.access-denied-container {
    background: white; border-radius: 12px; padding: 60px 40px;
    max-width: 500px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.access-denied-icon { font-size: 80px; color: #00b8a9; margin-bottom: 20px; }
.access-denied-container h1 { color: #2d3748; font-size: 32px; margin: 0 0 16px 0; }
.access-denied-container p { color: #718096; font-size: 18px; margin: 0 0 32px 0; line-height: 1.6; }
.access-denied-btn {
    display: inline-block; background: #00b8a9; color: white;
    padding: 14px 32px; border-radius: 8px; text-decoration: none;
    font-weight: 600; transition: all 0.3s;
}
.access-denied-btn:hover { background: #009688; transform: translateY(-2px); }

/* ═══════════════════════════════════════════════════════════
   Settings Layout — Sidebar Nav + Content Panel
   Inspired by Propwise / Keitoto Dribbble concept
   ═══════════════════════════════════════════════════════════ */

/* Two-column layout */
.stabs-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    margin: -32px;             /* bleed into .shukran-content padding */
}

/* ─── Sidebar ─── */
.stabs-sidebar {
    width: 272px;
    min-width: 272px;
    background: #fff;
    border-right: 1px solid #eef0f2;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Header row: back arrow + title */
.stabs-sidebar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 28px 24px 20px;
}
.stabs-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.18s;
    flex-shrink: 0;
    font-size: 22px;
    line-height: 1;
}
.stabs-back:hover {
    background: #f1f5f9;
    color: #0d9488;
}
.stabs-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
    margin: 0;
}

/* Nav area */
.stabs-nav {
    flex: 1;
    padding: 4px 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Group sections */
.stabs-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stabs-group + .stabs-group {
    margin-top: 20px;
}

/* Group heading */
.stabs-group-label {
    display: block;
    padding: 0 12px 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

/* Nav link */
.stabs-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.16s ease;
    position: relative;
}
.stabs-ico {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
    filter: grayscale(30%);
    transition: filter 0.16s;
}
.stabs-link:hover {
    background: #f8fafc;
    color: #1e293b;
}
.stabs-link:hover .stabs-ico {
    filter: grayscale(0%);
}

/* Active state */
.stabs-link.is-active {
    background: #f0fdfa;
    color: #0d9488;
    font-weight: 600;
}
.stabs-link.is-active .stabs-ico {
    filter: grayscale(0%);
}
.stabs-link.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: #14b8a6;
    border-radius: 0 3px 3px 0;
}

/* ─── Main content panel ─── */
.stabs-main {
    flex: 1;
    min-width: 0;
    padding: 28px 36px 40px;
    background: #f9fafb;
    overflow-y: auto;
}

/* ─── Mobile: sidebar becomes a top nav ─── */
@media (max-width: 860px) {
    .stabs-layout {
        flex-direction: column;
        min-height: auto;
        margin: -32px -16px;
    }
    .stabs-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #eef0f2;
        overflow-y: visible;
    }
    .stabs-sidebar-head {
        padding: 16px 20px 12px;
    }
    .stabs-title { font-size: 17px; }
    .stabs-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0 16px 12px;
        gap: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .stabs-nav::-webkit-scrollbar { display: none; }
    .stabs-group {
        flex-direction: row;
        gap: 4px;
    }
    .stabs-group + .stabs-group { margin-top: 0; }
    .stabs-group-label { display: none; }
    .stabs-link {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 13px;
    }
    .stabs-ico { font-size: 16px; }
    .stabs-link.is-active::before {
        left: 8px; right: 8px;
        top: auto; bottom: 0;
        width: auto; height: 2.5px;
        border-radius: 3px 3px 0 0;
    }
    .stabs-main {
        padding: 20px 16px 32px;
    }
}
@media (max-width: 480px) {
    .stabs-link span:not(.stabs-ico) { display: none; }
    .stabs-link { padding: 8px 10px; gap: 0; }
}

/* Legacy compat — hide old .settings-tabs if any partial still references it */
.settings-tabs { display: none; }

/* Cards & tables within stabs-main get enhanced styling */
.stabs-main .shukran-card {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.stabs-main .shukran-table {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.stabs-main .shukran-page-header {
    margin-bottom: 24px;
}
.stabs-main .shukran-page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #1e293b;
}
.stabs-main .shukran-page-subtitle {
    color: #94a3b8;
    margin-top: 4px;
    font-size: 14px;
}

/* Utility classes to replace inline styles */
.alert-success-banner {
    background: #dcfce7;
    color: #16a34a;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-warning-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 16px;
    border-radius: 8px;
}

.text-muted { color: #64748b; }
.text-warning { color: #d97706; }
.text-muted-light { color: #94a3b8; }

.form-hint {
    color: #64748b;
    font-size: 13px;
}

.heading-no-top { margin-top: 0; }
.heading-section { margin-top: 40px; }

.label-checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.text-center { text-align: center; }

.cell-center { text-align: center; }

.label-select-all { cursor: pointer; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

.modal-hidden { display: none; }

.settings-subtitle {
    color: #64748b;
    margin: 8px 0 0 0;
}

.placeholder-content {
    padding: 40px;
    text-align: center;
    color: #64748b;
}

.login-footer-spaced { margin-top: 15px; }

/* Module Bridge Notice */
.module-bridge-notice {
    text-align: center;
    padding: 60px 40px;
    max-width: 600px;
    margin: 40px auto;
}

.module-bridge-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.module-bridge-notice h2 {
    color: #1e293b;
    font-size: 24px;
    margin: 0 0 12px 0;
}

.module-bridge-notice p {
    color: #64748b;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.module-bridge-notice .btn {
    margin: 0 6px;
}

.module-bridge-notice code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: #e11d48;
}
