/* ==========================================================================
   ১. গ্লোবাল রিসেট এবং ভ্যারিয়েবল (Premium Bangla Font & Colors)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');

:root {
    /* Professional Brand Colors */
    --primary-color: #006A4E;     /* Deep Green (মাদরাসা থিম) */
    --secondary-color: #F5A623;   /* Accent Orange (হাইলাইট) */
    --bg-light: #F4F7F6;          /* Clean Light Background */
    --text-dark: #2C3E50;         /* Deep Slate Text */
    --text-muted: #7F8C8D;        /* Gray Muted Text */
    --white: #FFFFFF;
    --error-color: #E74C3C;       /* Soft Red for errors */
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

/* গ্লোবাল ওভারফ্লো লক করা হলো */
html, body {
    font-family: 'Hind Siliguri', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    width: 100%;
    max-width: 100%; /* 100vw পরিবর্তন করে 100% করা হয়েছে */
    overflow-x: hidden !important; /* মোবাইলে ডানে-বামে স্ক্রল চিরতরে বন্ধ */
}

/* যেকোনো লম্বা টেক্সট বা লিংক যেন স্ক্রিন না ভাঙে তার জন্য গ্লোবাল ফিক্স */
p, span, div, h1, h2, h3, h4, h5, h6, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
}

/* গ্লোবাল ফন্ট ফ্যামিলি (Premium Bangla Typography) */
body, h1, h2, h3, h4, h5, h6, p, a, span, button, input, select, td, th, label {
    font-family: 'Hind Siliguri', sans-serif !important;
}

/* ==========================================================================
   ২. বেসিক লেআউট স্ট্রাকচার (Header & Footer)
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 15px 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 106, 78, 0.15);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==========================================================================
   ৩. প্রফেশনাল লগইন কার্ড ডিজাইন (Auth Section)
   ========================================================================== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 75vh;
    padding: 40px 20px;
}

.auth-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 106, 78, 0.06), 0 1px 8px rgba(0, 0, 0, 0.02);
    width: 100%;
    max-width: 420px;
    padding: 40px 35px;
    border-top: 6px solid var(--primary-color);
    position: relative;
    transition: var(--transition);
}

.auth-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 106, 78, 0.1);
}

.auth-card h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 8px;
    font-size: 1.6rem;
    font-weight: 700;
}

.auth-card p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* ==========================================================================
   ৪. ইনপুট ফিল্ড এবং আইকন সেটআপ (Form Control)
   ========================================================================== */
.form-group {
    margin-bottom: 22px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i.left-icon {
    position: absolute;
    left: 16px;
    color: #a0aec0;
    font-size: 1.1rem;
    transition: var(--transition);
}

.input-icon-wrapper i.right-icon {
    position: absolute;
    right: 16px;
    cursor: pointer;
    color: #a0aec0;
    font-size: 1.1rem;
    padding: 5px;
    transition: var(--transition);
}

.input-icon-wrapper i.right-icon:hover {
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 14px 45px 14px 48px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-dark);
    background-color: #f8fafc;
    transition: var(--transition);
}

.form-control::placeholder {
    color: #cbd5e1;
}

.form-control:focus {
    border-color: var(--primary-color);
    background-color: var(--white);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 106, 78, 0.1);
}

.input-icon-wrapper:focus-within i.left-icon {
    color: var(--primary-color);
}

.form-control.is-invalid {
    border-color: var(--error-color);
    background-color: #fffaf0;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

/* ==========================================================================
   ৫. বাটন এবং অতিরিক্ত লিঙ্কসমূহ (Buttons & Links)
   ========================================================================== */
.btn-auth {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 106, 78, 0.2);
    transition: var(--transition);
    margin-top: 10px;
}

.btn-auth:hover {
    background: #00523C;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 106, 78, 0.3);
}

/* ==========================================================================
   ৬. মডার্ন ড্যাশবোর্ড UI
   ========================================================================== */
:root {
    --sidebar-bg: #0F172A;
    --sidebar-hover: #1E293B;
    --dash-bg: #F8FAFC;
    --card-bg: #FFFFFF;
}

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--dash-bg);
    width: 100%;
    overflow-x: hidden; /* রুট লেভেল স্ক্রল অফ */
}

/* সাইডবার */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #F1F5F9;
    padding: 20px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sidebar-brand {
    padding: 15px 25px 25px 25px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #10B981;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    list-style: none;
    margin-top: 20px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: #94A3B8;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
}

.sidebar-menu li a i {
    font-size: 1.2rem;
    width: 24px;
}

.sidebar-menu li a:hover, .sidebar-menu li.active a {
    background-color: var(--sidebar-hover);
    color: #10B981;
    border-left: 4px solid #10B981;
}

/* মেইন কন্টেন্ট ওভারফ্লো ফিক্স করা হলো */
.main-content {
    flex: 1; /* ড্যাশবোর্ডে সাইডবারের পাশের জায়গা নেওয়ার জন্য এটি জরুরি */
    min-width: 0; /* ম্যাজিক কোড: ফ্লেক্সবক্সকে টেবিলের চাপে বড় হওয়া থেকে আটকাবে */
    padding: 30px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: var(--transition);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 18px 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

.btn-logout-top {
    color: var(--error-color);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.015);
    border: 1px solid #E2E8F0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.08);
    border-color: #10B981;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.2;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.bg-students { background: #ECFDF5; color: #059669; }
.bg-teachers { background: #EFF6FF; color: #2563EB; }
.bg-staff { background: #F5F3FF; color: #7C3AED; }
.bg-earnings { background: #FFFBEB; color: #D97706; }

/* ==========================================================================
   ৭. ডিপ রেসপন্সিভ ডিজাইন (Mobile Fixes)
   ========================================================================== */
@media (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
    }

    .sidebar.active {
        left: 0;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    /* Top bar ওভারফ্লো ঠিক করা হলো */
    .top-bar {
        padding: 15px;
        flex-wrap: wrap; /* কন্টেন্ট বড় হলে নিচে নামবে, স্ক্রিন ভাঙবে না */
        gap: 15px;
    }

    .main-content {
        padding: 15px;
        width: 100% !important; /* 100vw এর কারণে পেজ ডানে সরে যাচ্ছিল, এটি 100% হবে */
        max-width: 100% !important;
        min-width: 0 !important; /* মোবাইলেও ফ্লেক্স ওভারফ্লো লক করা হলো */
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* লগইন পেজ ফিক্স */
    .auth-container {
        padding: 20px 15px;
    }

    .auth-card {
        padding: 30px 20px;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .user-info {
        font-size: 0.85rem;
    }

    .btn-logout-top span {
        display: none; /* মোবাইলে শুধু আইকন দেখাবে, লেখা হাইড হবে */
    }
}