/* style.css - Modern Responsive Styling for SAA/CCI Management */

:root {
    /* Color Palette */
    --primary: #4f46e5;         /* Elegant Indigo */
    --primary-light: #e0e7ff;   /* Light Indigo */
    --primary-dark: #3730a3;
    
    --secondary: #0d9488;       /* Warm Teal */
    --secondary-light: #ccfbf1;
    
    --accent: #f59e0b;          /* Soft Gold/Amber */
    --accent-light: #fef3c7;
    
    --coral: #f43f5e;           /* Coral/Rose for alerts */
    --coral-light: #ffe4e6;
    
    --text-dark: #1f2937;       /* Charcoal */
    --text-muted: #6b7280;      /* Muted Gray */
    --text-light: #f9fafb;
    
    --bg-main: #f3f4f6;         /* Cool Light Gray */
    --bg-surface: #ffffff;      /* Pure White for Cards */
    --bg-sidebar: #1e1b4b;      /* Deep Indigo Navy */
    
    --border-color: #e5e7eb;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --header-height: 70px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(79, 70, 229, 0.08), 0 4px 6px -2px rgba(79, 70, 229, 0.03);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
    
    /* Animations */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

a {
    text-decoration: none;
    color: inherit;
}

button, input, select, textarea {
    font-family: inherit;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar Navigation */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--accent);
    filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.5));
}

.logo span {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-category {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 1rem 0.5rem 0.5rem;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.25rem;
    transition: all var(--transition-fast);
    font-size: 0.95rem;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-light);
    background-color: rgba(255,255,255,0.05);
}

.nav-item:hover i {
    transform: translateX(3px);
}

.nav-item.active {
    background-color: var(--primary);
    color: var(--text-light);
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Navigation Dropdown Submenus */
.nav-item-dropdown {
    margin-bottom: 0.25rem;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.nav-dropdown-toggle i:first-child {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-dropdown-toggle span {
    flex: 1;
    margin-left: 1rem;
}

.nav-dropdown-toggle .dropdown-arrow {
    font-size: 0.8rem;
    transition: transform var(--transition-normal);
}

.nav-dropdown-toggle:hover {
    color: var(--text-light);
    background-color: rgba(255,255,255,0.05);
}

/* When dropdown is open */
.nav-item-dropdown.open .nav-dropdown-toggle .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-item-dropdown.open .nav-dropdown-toggle {
    color: var(--text-light);
    background-color: rgba(255,255,255,0.03);
}

/* Dropdown Submenu Container */
.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
}

.nav-item-dropdown.open .nav-dropdown-menu {
    max-height: 400px; /* High enough to contain all links */
}

/* Dropdown Menu Items */
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-bottom: 0.15rem;
}

.nav-dropdown-item i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    color: rgba(255,255,255,0.5);
    transition: color var(--transition-fast);
}

.nav-dropdown-item:hover {
    color: var(--text-light);
    background-color: rgba(255,255,255,0.05);
}

.nav-dropdown-item:hover i {
    color: var(--accent);
}

.nav-dropdown-item.active {
    background-color: rgba(79, 70, 229, 0.15);
    color: var(--text-light);
    font-weight: 500;
    border-left: 3px solid var(--primary);
    padding-left: calc(1rem - 3px);
}

.nav-dropdown-item.active i {
    color: var(--primary-light);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    background-color: rgba(0,0,0,0.15);
    border-top: 1px solid rgba(255,255,255,0.05);
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    font-size: 2rem;
    color: var(--primary-light);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

/* Main Layout Content */
.main-layout {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

/* Top Navbar */
.top-navbar {
    height: var(--header-height);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-dark);
    cursor: pointer;
    display: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.menu-toggle-btn:hover {
    background-color: var(--bg-main);
}

.page-title {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.system-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    background-color: var(--bg-main);
    padding: 0.5rem 1rem;
    border-radius: 30px;
}

/* Page Content wrap */
.page-content {
    flex: 1;
    padding: 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* App Footer */
.app-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Dashboard Widget Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary);
}

.stat-card.secondary::before { background-color: var(--secondary); }
.stat-card.accent::before { background-color: var(--accent); }
.stat-card.coral::before { background-color: var(--coral); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
}

.stat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.stat-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background-color: var(--primary-light);
    color: var(--primary);
}

.stat-card.secondary .stat-icon-wrap {
    background-color: var(--secondary-light);
    color: var(--secondary);
}

.stat-card.accent .stat-icon-wrap {
    background-color: var(--accent-light);
    color: var(--accent);
}

.stat-card.coral .stat-icon-wrap {
    background-color: var(--coral-light);
    color: var(--coral);
}

/* Dashboard Sections Layout */
.dashboard-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .dashboard-sections {
        grid-template-columns: 1fr;
    }
}

/* Standard Content Cards */
.content-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

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

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--primary);
}

/* Tables and Lists */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-top: 0.5rem;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:hover td {
    background-color: rgba(79, 70, 229, 0.02);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-info {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background-color: var(--secondary-light);
    color: var(--secondary);
}

.badge-warning {
    background-color: var(--accent-light);
    color: var(--accent);
}

.badge-danger {
    background-color: var(--coral-light);
    color: var(--coral);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-light);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text-light);
}

.btn-secondary:hover {
    background-color: #0f766e;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
}

.btn-outline {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
}

.btn-outline:hover {
    background-color: var(--bg-main);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Forms layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-dark);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Grid Views (Cards Grid instead of tables on mobile) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.entity-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.entity-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.entity-card-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.entity-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.entity-title-wrap {
    display: flex;
    flex-direction: column;
}

.entity-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.entity-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.entity-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    font-weight: 500;
}

.entity-card-actions {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-main);
    display: flex;
    gap: 0.5rem;
}

/* Search and Filters Header Section */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background-color: var(--bg-surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-input-wrap i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrap input {
    padding-left: 2.5rem;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 27, 75, 0.4); /* Transparent Dark Indigo Overlay */
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: color var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--coral);
}

.modal-body {
    padding: 1.5rem;
}

/* Activity Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -29px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--bg-surface);
    background-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.timeline-item.secondary .timeline-marker {
    background-color: var(--secondary);
    box-shadow: 0 0 0 3px var(--secondary-light);
}

.timeline-item.accent .timeline-marker {
    background-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.timeline-content {
    background-color: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.timeline-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.timeline-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.timeline-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .timeline-grid {
        grid-template-columns: 1fr;
    }
}

.timeline-item.pending .timeline-marker {
    background-color: #9ca3af;
    box-shadow: 0 0 0 3px var(--border-color);
}

.timeline-item.pending .timeline-content {
    opacity: 0.7;
    background-color: transparent;
    border: 1px dashed var(--border-color);
}

.timeline-item.danger .timeline-marker {
    background-color: var(--coral);
    box-shadow: 0 0 0 3px var(--coral-light);
}

.timeline-item.danger .timeline-content {
    background-color: var(--coral-light);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.timeline-table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.timeline-table th {
    background-color: var(--bg-main);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}

.timeline-table th, .timeline-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* RESPONSIVE LAYOUT BREAKPOINTS */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.active {
        transform: translateX(0);
    }
    
    .close-sidebar-btn {
        display: block;
    }
    
    .main-layout {
        margin-left: 0;
    }
    
    .menu-toggle-btn {
        display: block;
    }
    
    .top-navbar {
        padding: 0 1.25rem;
    }
    
    .page-content {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input-wrap {
        max-width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .filter-actions select {
        flex: 1;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    td, th {
        padding: 0.75rem 0.5rem;
    }
}
