:root {
    --saudi-green: #006C35;
    --saudi-green-dark: #004d26;
    --saudi-green-light: #00A859;
    --gold: #D4AF37;
    --gold-light: #f1d279;
    --slate: #2F3E46;
    --background: #F0F4F2;
    --white: #FFFFFF;
    --glass: rgba(255, 255, 255, 0.9);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --danger: #E63946;
    --warning: #FFB703;
    --success: #2A9D8F;
}

html {
    font-size: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}


body {
    background-color: var(--background);
    background-image:
        radial-gradient(at 0% 0%, rgba(0, 108, 53, 0.03) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(212, 175, 55, 0.03) 0, transparent 50%);
    color: var(--slate);
    min-height: 100vh;
}

.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar */
aside {
    background: linear-gradient(180deg, var(--saudi-green) 0%, var(--saudi-green-dark) 100%);
    color: var(--white);
    padding: 2.5rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 3.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--gold);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--saudi-green);
    font-weight: 800;
    font-size: 1.3rem;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.5px;
}

.logo-text p {
    font-size: 0.75rem;
    opacity: 0.7;
    margin: 0;
    font-weight: 300;
}

.sidebar-info-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 15px;
    font-size: 0.75rem;
    margin-bottom: 2rem;
    border-right: 4px solid var(--gold);
    line-height: 1.5;
}

.nav-menu {
    list-style: none;
    padding: 0;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.6rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    font-weight: 500;
}

.nav-link i {
    font-size: 1.2rem;
    opacity: 0.8;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    transform: translateX(-8px);
}

.nav-link.active {
    background: var(--gold);
    color: var(--saudi-green) !important;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
}

.sidebar-footer {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    opacity: 0.5;
    text-align: center;
}

/* Main Layout */
main {
    padding: 2.5rem 4rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.03);
}

.page-title h2 {
    font-size: 1.8rem;
    color: var(--saudi-green);
    font-weight: 800;
    margin: 0;
}

.page-title p {
    font-size: 0.95rem;
    color: #777;
    margin-top: 0.2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: var(--white);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 700;
    color: var(--saudi-green);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.75rem;
    color: #999;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--saudi-green-light);
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    border-right: 6px solid var(--saudi-green);
    transition: all 0.4s ease;
    overflow: hidden;
    position: relative;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: rgba(0, 108, 53, 0.03);
    border-radius: 50%;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-right-color: var(--gold);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(0, 108, 53, 0.06);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--saudi-green);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 0.85rem;
    color: #888;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--saudi-green);
}

/* Library Controls */
.controls-section {
    background: var(--white);
    padding: 1.8rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2.5rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.search-wrapper {
    flex-grow: 1;
    position: relative;
}

.search-wrapper input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    border: 2px solid #F0F0F0;
    border-radius: 15px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
    background: #FAFAFA;
}

.search-wrapper input:focus {
    border-color: var(--saudi-green-light);
    background: #FFF;
    box-shadow: 0 0 0 4px rgba(0, 168, 89, 0.1);
}

.search-wrapper i {
    position: absolute;
    right: 1.4rem;
    top: 50%;
    transform: translateY(-50%);
    color: #BBB;
    font-size: 1.2rem;
}

/* Guidance Cards */
.guidance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2.5rem;
}

.guidance-card {
    background: var(--white);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.guidance-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px);
    border-color: var(--saudi-green-light);
}

.card-category {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--saudi-green);
    background: rgba(0, 108, 53, 0.08);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    align-self: flex-start;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--slate);
    margin-bottom: 0.8rem;
    line-height: 1.4;
    min-height: 3.4rem;
}

.card-excerpt {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #F0F0F0;
    padding-top: 1.5rem;
    margin-top: auto;
}

.entity-tag {
    font-size: 0.9rem;
    color: var(--saudi-green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.view-btn {
    background: var(--saudi-green);
    color: white !important;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 108, 53, 0.2);
}

.view-btn:hover {
    background: var(--saudi-green-light);
    transform: scale(1.05);
}

/* Registry Table */
.registry-table-container {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.table.align-middle thead th {
    font-weight: 800;
    color: var(--saudi-green);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #F0F0F0;
}

.status-badge {
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.8rem;
    display: inline-block;
}

.status-compliant {
    background: rgba(42, 157, 143, 0.1);
    color: #2A9D8F;
}

.status-review {
    background: rgba(230, 57, 70, 0.1);
    color: #E63946;
}

.status-progress {
    background: rgba(255, 183, 3, 0.1);
    color: #FFB703;
}

/* Modal Detail */
.detail-modal .modal-dialog {
    max-width: 1100px;
    /* Wider modal as requested */
    margin: 1.5rem auto;
}

.detail-modal .modal-content {
    border-radius: 20px;
    overflow: hidden;
    border: none;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.modal-header-banner {
    background: linear-gradient(135deg, var(--saudi-green) 0%, var(--saudi-green-dark) 100%);
    padding: 2rem;
    color: white;
    text-align: center;
    position: relative;
}

.modal-header-banner h1 {
    font-size: 1.6rem !important;
    font-weight: 800;
    margin: 0;
}

.modal-header-banner::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.detail-section {
    position: relative;
    padding-right: 1.5rem;
}

.section-label {
    display: block;
    font-size: 0.95rem;
    color: var(--saudi-green);
    font-weight: 800;
    margin-bottom: 0.75rem;
    position: relative;
}

.section-label::after {
    content: '';
    position: absolute;
    right: -1.5rem;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gold);
    border-radius: 2px;
}

.detail-text {
    line-height: 1.8;
    color: var(--slate);
    font-size: 1.05rem;
    margin: 0;
}

.main-description {
    font-size: 1.15rem;
    font-weight: 500;
}

.detail-list li {
    position: relative;
    padding-right: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.detail-list li::before {
    content: '•';
    position: absolute;
    right: 0;
    color: var(--gold);
    font-weight: bold;
}

.example-box.premium {
    background: #f9fbfb;
    border: 1px dashed var(--saudi-green-light);
    padding: 1.5rem;
    border-radius: 15px;
    color: var(--saudi-green-dark);
    font-weight: 600;
    line-height: 1.7;
    box-shadow: inset 0 2px 10px rgba(0, 108, 53, 0.02);
}

.mistake-box {
    background: #fffafa;
    border-right: 4px solid var(--danger);
    padding: 1.25rem;
    border-radius: 10px;
    color: #555;
}

.info-row {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    display: block;
    color: var(--saudi-green);
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.info-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--slate);
}

.info-list {
    list-style: none;
    padding: 0;
}

.info-list li {
    padding: 0.8rem 1.2rem;
    background: #fdfdfd;
    border-right: 4px solid var(--gold);
    margin-bottom: 0.6rem;
    border-radius: 4px;
}

.example-banner {
    background: #f0f7f4;
    border: 1px dashed var(--saudi-green);
    padding: 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    color: var(--saudi-green-dark);
}

.compliance-banner {
    background: #f9fbfb;
    border-right: 5px solid var(--saudi-green);
    padding: 1.5rem;
    border-radius: 8px;
}

.compliance-card-modern {
    background: #f4f8f6;
    border: 1px solid rgba(0, 108, 53, 0.1);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.compliance-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1));
}

.compliance-content p {
    font-size: 0.95rem;
    color: var(--saudi-green-dark);
    font-weight: 600;
}

/* Comments */
.comments-section {
    border-top: 1px solid #EEE;
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.comments-section h4 {
    font-size: 1.2rem !important;
    margin-bottom: 1rem !important;
}

.comment-item {
    background: #FCFCFC;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid #F3F3F3;
}

.comment-author {
    font-weight: 700;
    color: var(--saudi-green);
    font-size: 0.9rem;
}

.comment-date {
    font-size: 0.75rem;
    color: #BBB;
}

.comment-text {
    margin-top: 0.5rem;
    color: #555;
    line-height: 1.5;
    font-size: 0.9rem;
}

.comment-form-container {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 12px;
}

.comment-form-container h5 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

textarea.form-control,
input.form-control {
    border-radius: 8px;
    border: 1px solid #DDD;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

/* Submit Guidance Modal Mobile Fix */
@media (max-width: 768px) {
    #submitGuidanceModal .modal-body {
        max-height: 80vh;
        overflow-y: auto;
        padding: 1.5rem !important;
    }

    #submitGuidanceModal .modal-footer,
    #submitGuidanceModal .mt-4 {
        padding-top: 1rem;
        padding-bottom: 2rem;
    }

    #submitGuidanceModal button[type="submit"] {
        width: 100%;
        margin-bottom: 1rem;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 1fr;
        overflow-x: hidden;
    }

    aside {
        position: fixed;
        right: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 2000;
        transition: right 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    }

    aside.mobile-active {
        right: 0;
    }

    main {
        padding: 1rem;
        width: 100%;
        overflow-x: hidden;
    }

    .main-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .user-profile {
        width: 100%;
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .controls-section {
        flex-direction: column;
        align-items: stretch !important;
        padding: 1.2rem;
        gap: 1rem;
    }

    .controls-section .d-flex {
        flex-direction: column;
        width: 100%;
        gap: 0.8rem !important;
    }

    .controls-section select,
    .controls-section button {
        width: 100% !important;
        margin: 0;
    }

    .guidance-grid {
        grid-template-columns: 1fr !important;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .guidance-card {
        padding: 1.5rem;
    }

    .registry-table-container {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1500;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 576px) {
    .page-title h2 {
        font-size: 1.4rem;
    }

    .view-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
}