/* General Resets & Body Styles */
:root {
    --primary-blue: #007bff;
    --primary-dark: #2c3e50;
    --secondary-gray: #ecf0f1;
    --text-color: #34495e;
    --border-color: #e0e0e0;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --section-bg: #ffffff;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.1);

    --table-header-bg: #f5f7fa;
    --table-row-hover-bg: #fcfcfc;

    /* Form specific colors */
    --input-border: #ccc;
    --input-focus-border: var(--primary-blue);
    --input-bg: #fdfdfd;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif; /* Ensure 'Inter' font is available or choose another */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--secondary-gray);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.app-header {
    background-color: var(--primary-dark);
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-light);
}

.app-header .logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.main-nav .nav-item {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    position: relative;
}

.main-nav .nav-item:hover,
.main-nav .nav-item.active {
    color: var(--primary-blue);
}

.main-nav .nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 2px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #fff;
}

.user-profile i {
    font-size: 1.2rem;
}

.nav-lin { /* Specific styling for login link */
    color: #FFD700 !important; /* Gold color for Login */
    text-decoration: none;
    font-weight: bold;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Allow sections to stack */
    /* Removed padding here, as sections will handle their own padding */
    position: relative;
}

/* General Section Headings */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: 15px;
}

.section-subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    text-align: center;
    max-width: 700px;
    margin: 0 auto 60px;
}

/* Hero Section */
.hero-section {
    position: relative;
    /* Update this line with the path to your image */
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../img/banner.png') no-repeat center center/cover;
    color: #fff;
    padding: 100px 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}


.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.hero-logo {
    width: 200px;
    margin-bottom: 20px;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-section .lead {
    font-size: 1.5rem;
    font-weight: 300;
    max-width: 700px;
    margin: 0 auto 30px;
}

/* Features Section */
.features-section {
    padding: 80px 0;
    background-color: var(--secondary-gray);
}

.feature-card {
    background-color: var(--section-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
}

.feature-card .card-img-container {
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f7;
}

.feature-card .card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

.feature-card .card-body {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.feature-card .card-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.feature-card .card-text {
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.7;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Call to Action Section */
.cta-section {
    background-color: var(--primary-blue);
    padding: 80px 20px;
    text-align: center;
    color: #fff;
}

.cta-section .section-title {
    color: #fff;
    margin-bottom: 20px;
}

.cta-section .lead {
    font-size: 1.3rem;
    max-width: 700px;
    margin: 0 auto 40px;
    color: rgba(255, 255, 255, 0.8);
}

.cta-section .btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    font-weight: 600;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: var(--primary-dark);
}
.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: var(--primary-dark);
}

/* Contact Section */
.contact-section {
    background-color: var(--primary-dark);
    color: #fff;
    padding: 60px 20px;
    text-align: center;
    box-shadow: var(--shadow-medium);
    margin-top: 50px;
}

.contact-section .contact-content {
    max-width: 800px;
    margin: 0 auto;
}

.contact-section h2 {
    font-size: 2.8em;
    margin-bottom: 15px;
    font-weight: 700;
    color: #fff;
}

.contact-section p {
    font-size: 1.1em;
    margin-bottom: 40px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
}

.contact-methods {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-size: 1.1em;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.3s ease;
}

.contact-item i {
    font-size: 3em;
    margin-bottom: 10px;
    color: #fff;
    transition: color 0.3s ease;
}

.contact-item span {
    display: block;
}

.contact-item:hover {
    color: var(--primary-blue);
    transform: translateY(-5px);
}

.contact-item:hover i {
    color: var(--primary-blue);
}

/* Footer Styles */
.app-footer {
    background-color: var(--primary-dark);
    color: #fff;
    padding: 60px 20px;
    margin-top: auto;
}

.app-footer h3, .app-footer h4 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.app-footer p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
}

.app-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-footer ul li {
    margin-bottom: 10px;
}

.app-footer ul li a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.app-footer ul li a:hover {
    color: var(--primary-blue);
}

.app-footer .social-icons a {
    color: #fff;
    font-size: 1.8rem;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.app-footer .social-icons a:hover {
    color: var(--primary-blue);
}

.app-footer a {
    color: var(--primary-blue);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    /* Adjustments for larger tablets/small desktops */
}

@media (max-width: 992px) {
    .app-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }
    .user-profile {
        margin-top: 0.5rem;
    }

    .hero-section h1 {
        font-size: 2.8rem;
    }
    .hero-section .lead {
        font-size: 1.2rem;
    }
    .hero-logo {
        width: 180px;
    }

    .section-title {
        font-size: 2rem;
    }
    .section-subtitle {
        font-size: 1.1rem;
        margin-bottom: 40px;
    }
    .feature-card .card-img-container {
        height: 180px;
    }

    .cta-section .section-title {
        font-size: 2.2rem;
    }
    .cta-section .lead {
        font-size: 1.2rem;
    }

    .contact-section h2 {
        font-size: 2.2em;
    }
    .contact-section p {
        font-size: 1em;
    }

    .app-footer .footer-col {
        margin-bottom: 30px;
        text-align: center;
    }
    .app-footer h3, .app-footer h4 {
        text-align: center;
    }
    .app-footer ul {
        text-align: center;
    }
    .app-footer ul li {
        display: inline-block;
        margin: 0 10px 10px 0;
    }
    .app-footer .social-icons {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
        padding: 80px 15px;
    }
    .hero-section h1 {
        font-size: 2.2rem;
    }
    .hero-section .lead {
        font-size: 1rem;
    }
    .hero-logo {
        width: 150px;
    }
    .hero-section .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }

    .features-section {
        padding: 50px 0;
    }
    .section-title {
        font-size: 1.8rem;
    }
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    .feature-card .card-img-container {
        height: 160px;
    }
    .feature-card .card-body {
        padding: 20px;
    }
    .feature-card .card-title {
        font-size: 1.2rem;
    }

    .cta-section {
        padding: 50px 15px;
    }
    .cta-section .section-title {
        font-size: 2rem;
    }
    .cta-section .lead {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    .cta-section .btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .contact-section {
        padding: 40px 15px;
    }
    .contact-section h2 {
        font-size: 2em;
    }
    .contact-section p {
        font-size: 1em;
        margin-bottom: 30px;
    }
    .contact-methods {
        flex-direction: column;
        gap: 20px;
    }
    .contact-item i {
        font-size: 2.5em;
    }

    /* Keep existing table/modal specific media queries from your base2.css for other pages */
}

/* User Rules Section (inline table) - Existing Styles */
.user-rules-section {
    background-color: var(--section-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    width: 90%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 2rem auto; /* Added margin for section */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.section-body {
    padding: 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

/* Table Specific Styles */
.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: 6px;
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.rules-table th,
.rules-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.rules-table th {
    background-color: var(--table-header-bg);
    color: var(--primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

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

.rules-table tbody tr:hover {
    background-color: var(--table-row-hover-bg);
}

/* Specific Column Styling */
.rules-table td:first-child {
    font-weight: 600;
    color: var(--primary-blue);
    min-width: 40px;
    text-align: center;
}

.rules-table td:nth-child(2) {
    max-width: 350px;
}

.rule-text-truncated {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rtl-text {
    direction: rtl;
    text-align: right;
}

.view-details-btn {
    background-color: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-top: 0.5rem;
    display: inline-block;
}

.view-details-btn:hover {
    background-color: var(--primary-blue);
    color: #fff;
}

.status-badge {
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-badge.active {
    background-color: #e6ffe6;
    color: var(--success-green);
}

.status-badge.inactive {
    background-color: #ffe6e6;
    color: var(--danger-red);
}

.rules-table .action-btn {
    font-size: 1rem;
    padding: 0.5rem;
    margin-left: 0.2rem;
}

.rules-table td:last-child {
    white-space: nowrap;
    text-align: center;
}

/* Add New Rule Button */
.add-rule-section {
    text-align: right;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.add-new-rule-btn {
    background-color: var(--success-green);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.add-new-rule-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
    font-style: italic;
    width: 100%;
    display: block;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ccc;
}

/* --- NEW MODAL STYLES FOR ADD/EDIT RULE FORM --- */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-container {
    background-color: var(--section-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    width: 90%;
    max-width: 600px;
    z-index: 1000;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 95vh;
    overflow: hidden;
}

.modal-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--danger-red);
}

.modal-body {
    padding: 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-dark);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--input-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--input-focus-border);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    margin-top: 1.5rem;
}

.form-group-checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 0.8rem;
    transform: scale(1.2);
    cursor: pointer;
}

.form-group-checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    border: 1px solid transparent;
}

.button-primary {
    background-color: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
}

.button-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.button-secondary {
    background-color: #f0f0f0;
    color: var(--text-color);
    border-color: #ccc;
}

.button-secondary:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

/* Mobile Specific Adjustments for Tables/Modals */
@media (max-width: 768px) {
    .main-content {
        padding: 0; /* Remove main content padding to allow sections to stretch */
    }

    .user-rules-section {
        width: 100%;
        max-width: none;
        box-shadow: none;
        border-radius: 0;
    }

    .section-header {
        padding: 1rem;
    }

    .section-body {
        padding: 1rem;
    }

    .table-container {
        border: none;
    }

    .rules-table, .rules-table tbody, .rules-table tr, .rules-table td {
        display: block;
        width: 100%;
    }

    .rules-table thead {
        display: none;
    }

    .rules-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        overflow: hidden;
        background-color: #fff;
    }

    .rules-table td {
        text-align: right;
        padding: 0.8rem 1rem;
        border-bottom: 1px dashed var(--border-color);
        position: relative;
        padding-left: 50%;
    }

    .rules-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: calc(50% - 1.5rem);
        text-align: left;
        font-weight: 600;
        color: var(--primary-dark);
        text-transform: uppercase;
        font-size: 0.8rem;
    }

    .rules-table td:last-child {
        border-bottom: none;
        text-align: center;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .rule-text-truncated {
        white-space: normal;
        text-overflow: unset;
        display: inline;
    }
    .view-details-btn {
        margin-top: 0;
        margin-left: 0.5rem;
    }

    .modal-container {
        width: 95%;
        max-width: none;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }
    .modal-header, .modal-body {
        padding: 1rem;
    }
    .form-actions {
        flex-direction: column;
        gap: 0.8rem;
    }
    .form-actions button {
        width: 100%;
    }
}