/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap');

/* Base Styles */
body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f0f4f7;
    color: #333; /* Default text color for light mode */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}

/* Ministry Identity Colors (Updated) */
.bg-primary { background-color: #158285; }
.bg-secondary { background-color: #FDB913; }
.bg-accent { background-color: #F7941D; }
.text-primary { color: #006764; }
.text-dark-accent { color: #006764; }
.border-primary { border-color: #006764; }
.hover-bg-accent:hover { background-color: #F7941D; }

/* --- AI Chat Widget Styles --- */
#chat-fab {
    position: fixed;
    bottom: 25px;
    width: auto; /* Allow the container to fit the text */
    height: auto;
    background-color: transparent !important; /* Make the main container transparent */
    box-shadow: none !important;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}
/* Style for the inner circle */
#chat-fab-circle {
    width: 60px;
    height: 60px;
    background-color: #F7941D; /* Original FAB color */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
#chat-fab:hover #chat-fab-circle {
    transform: scale(1.1);
}
#chat-fab-label {
    font-weight: bold;
    transition: all 0.3s ease;
    /* Styles for the label beside the icon might need adjustments */
    position: absolute; /* Example positioning */
    right: 70px; /* Adjust based on icon size */
    top: 50%;
    transform: translateY(-50%);
    background-color: white; /* Optional: background for label */
    padding: 5px 10px; /* Optional: padding */
    border-radius: 5px; /* Optional: rounding */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Optional: shadow */
    white-space: nowrap; /* Prevent wrapping */
    color: #333; /* Label text color */
    display: none; /* Hide label initially, show on hover? */
}
/* #chat-fab:hover #chat-fab-label { display: block; } */ /* Uncomment to show label on hover */


#chat-window {
    position: fixed;
    bottom: 100px;
    width: 350px;
    height: 500px;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: none; /* Start hidden */
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}
#chat-window.open {
    display: flex;
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}
.chat-header {
    background-color: #F7941D;
    color: white;
    padding: 15px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f0f4f7;
    display: flex;
    flex-direction: column;
}
.message {
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
}
.user-message {
    background-color: #FDB913;
    color: #333;
    align-self: flex-end;
}
.ai-message {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
}
.chat-input-form {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
}
.chat-input-form input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    margin-left: 8px; /* For LTR */
}
[dir="rtl"] .chat-input-form input {
    margin-left: 0;
    margin-right: 8px; /* For RTL */
}
.chat-input-form button {
    background-color: #2BB574;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0 15px;
    cursor: pointer;
}

/* RTL/LTR Positioning */
[dir="rtl"] #chat-fab, [dir="rtl"] #chat-window {
    right: auto;
    left: 25px;
    transform-origin: bottom left;
}
[dir="ltr"] #chat-fab, [dir="ltr"] #chat-window {
    left: auto;
    right: 25px;
    transform-origin: bottom right;
}

/* 🌐 تحسين مظهر الحقول في جميع النماذج */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #B8C3D6; /* لون هادئ من الهوية */
  border-radius: 8px; /* زوايا ناعمة */
  background-color: #fff;
  transition: all 0.2s ease-in-out;
  font-size: 0.95rem;
  color: #333; /* Default text color */
}

input:focus,
select:focus,
textarea:focus {
  border-color: #006764; /* Use primary color for focus */
  box-shadow: 0 0 0 3px rgba(0, 103, 100, 0.15); /* Adjusted shadow color */
  outline: none;
}

label {
  font-weight: 600;
  color: #2C3E50; /* Darker label color */
  margin-bottom: 4px;
  display: inline-block;
}

/* زر الحفظ الموحد */
button[type="submit"], .btn-primary {
  background-color: #2BB574; /* Use primary color */
  color: white;
  font-weight: 600;
  border-radius: 30px; /* Fully rounded */
  padding: 10px 24px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

button[type="submit"]:hover, .btn-primary:hover {
  background-color: #2BB574a; /* Darker shade for hover */
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* General Sidebar Styles */
aside {
    /* Existing styles */
    min-height: 100vh; /* Ensure sidebar takes full height */
}

aside nav ul {
    width: 100%;
}
aside nav li a, aside nav li button {
    /* Existing styles */
    width: 100%;
    display: flex;
    align-items: center;
    text-align: right; /* Ensure text aligns right in RTL */
}
[dir="ltr"] aside nav li a, [dir="ltr"] aside nav li button {
    text-align: left; /* Align left in LTR */
}
/* Style for submenu items */
.submenu {
    background-color: rgba(0, 0, 0, 0.1); /* Slightly darker background for submenu */
    padding-top: 8px;
    padding-bottom: 8px;
    border-radius: 8px;
}
.submenu li a {
    padding: 8px 16px; /* Adjust padding for submenu items */
    font-size: 0.9rem;
}

/* Rotate arrow icon */
.rotate-180 {
  transform: rotate(180deg);
}
.arrow-icon {
    transition: transform 0.2s ease-in-out;
}

/* User info section styling */
.theme-icon {
    cursor: pointer;
    font-size: 1.1rem; /* Adjust icon size */
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.theme-icon:hover {
    opacity: 1;
}
.hidden {
    display: none;
}


/* --- 💡 Dark Mode Styles (Add !important strategically) --- */
html.dark body {
    background-color: #1a202c !important; /* Force dark background */
    color: #cbd5e0 !important; /* Force light text */
}

/* Dark Sidebar */
/* (Keep sidebar styles as they are, they seem to work) */
html.dark aside.bg-primary {
    background-color: #171923; /* Even darker sidebar */
    border-right: 1px solid #2d3748;
}
html.dark aside h3, html.dark aside p, html.dark aside span {
    color: #e2e8f0; /* Lighter text in sidebar */
}
html.dark aside a, html.dark aside button {
    color: #e2e8f0; /* Lighter link text */
}
html.dark aside a:hover,
html.dark aside button:hover,
html.dark .hover-bg-accent:hover {
    background-color: #2d3748; /* Darker gray-blue hover */
}
html.dark .submenu {
    background-color: rgba(0, 0, 0, 0.25); /* Darker submenu */
}

/* Dark Content Area */
html.dark .bg-white {
    background-color: #2d3748 !important; /* Force dark panel background */
    border-color: #4a5568 !important; /* Force gray border */
}

/* Dark Headings and Labels */
html.dark h1, html.dark h2, html.dark h3, html.dark label {
    color: #e2e8f0 !important; /* Force lighter gray */
}
/* Force text colors, overriding Tailwind specifics */
html.dark .text-gray-800 { color: #e2e8f0 !important; }
html.dark .text-gray-700 { color: #cbd5e0 !important; }
html.dark .text-gray-600 { color: #a0aec0 !important; }
html.dark .text-gray-500 { color: #718096 !important; }
html.dark .text-\[\#006d86\] { color: #63b3ed !important; } /* Adjust custom color for dark */


/* Dark Text */
html.dark p, html.dark td, html.dark span, html.dark li {
    color: #cbd5e0 !important; /* Force light gray */
}

/* Dark Forms */
html.dark input[type="text"],
html.dark input[type="number"],
html.dark input[type="email"],
html.dark input[type="date"],
html.dark input[type="password"],
html.dark select,
html.dark textarea {
    background-color: #1a202c !important; /* Force very dark background */
    border-color: #4a5568 !important; /* Force gray border */
    color: #e2e8f0 !important; /* Force light text */
}
html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #718096 !important; /* Force lighter placeholder */
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
     border-color: #63b3ed !important; /* Force light blue focus border */
     box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.3) !important;
     background-color: #2d3748 !important; /* Force slightly lighter background on focus */
}
html.dark input[readonly], html.dark input.bg-gray-100 {
     background-color: #2d3748 !important;
     opacity: 0.7 !important;
}


/* Dark Tables */
/* (Keep table styles relatively the same) */
html.dark table thead th {
    color: #a0aec0 !important; /* Lighter gray header text */
    border-color: #4a5568 !important; /* Gray border */
}
html.dark table tbody tr {
    border-color: #4a5568 !important;
}
html.dark table tbody tr.bg-gray-50 {
    background-color: #2d3748 !important; /* Match panel background */
}
html.dark table tbody tr:hover,
html.dark table tbody tr.hover\:bg-gray-50:hover,
html.dark table tbody tr.hover\:bg-gray-100:hover {
    background-color: #4a5568 !important; /* Darker gray hover */
}

/* Dark Borders */
html.dark .border-primary { border-color: #4a5568 !important; }
html.dark .border-gray-200 { border-color: #4a5568 !important; }
html.dark .border-gray-300 { border-color: #4a5568 !important; }
html.dark .border-b, html.dark .border-t { border-color: #4a5568 !important; }

/* Dark Buttons & Links */
/* (Keep button styles relatively the same, adjust links) */
html.dark .text-blue-600 { color: #63b3ed !important; }
html.dark .text-green-600 { color: #48bb78 !important; }
html.dark .text-red-600 { color: #f56565 !important; }
html.dark a.text-gray-600 { color: #a0aec0 !important; }
html.dark a.font-semibold.text-gray-600 { color: #a0aec0 !important; }


/* Dark Chat Widget */
/* (Keep chat widget styles relatively the same) */
html.dark #chat-fab-circle { background-color: #008f86; }
html.dark #chat-window { background-color: #1a202c; border: 1px solid #4a5568; }
html.dark .chat-header { background-color: #2d3748; border-bottom: 1px solid #4a5568; }
html.dark .chat-messages { background-color: #1a202c; }
html.dark .chat-input-form { border-top-color: #4a5568; }
html.dark .chat-input-form input { background-color: #2d3748 !important; border-color: #4a5568 !important; color: #e2e8f0 !important; }
html.dark .ai-message { background-color: #4a5568; color: #e2e8f0; }
html.dark .user-message { background-color: #FDB913; color: #1a202c; }
html.dark .chat-input-form button { background-color: #008f86; }


/* --- End Dark Mode Styles --- */

/* Loader note: مؤثر التحميل معزول داخل Shadow DOM عبر JS، لذلك لا توجد هنا أي قواعد CSS تؤثر على الواجهة. */
