@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    
    --border-color: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout Elements */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at top right, #e0e7ff 0%, #f8fafc 100%);
}

.auth-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-muted);
}

.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo-section h2 {
    font-size: 22px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid var(--primary);
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role-tag {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Page Containers */
.main-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-info h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    font-family: 'Outfit', sans-serif;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.pending { background-color: var(--warning-light); color: var(--warning); }
.stat-icon.progress { background-color: var(--info-light); color: var(--info); }
.stat-icon.review { background-color: var(--purple-light); color: var(--purple); }
.stat-icon.completed { background-color: var(--success-light); color: var(--success); }
.stat-icon.total { background-color: var(--primary-light); color: var(--primary); }

/* Forms Style */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

.card h2 {
    font-size: 22px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
    color: #334155;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    background-color: #fff;
    color: var(--text-main);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

input[readonly] {
    background-color: #f1f5f9;
    color: #475569;
    cursor: not-allowed;
}

.mandatory-section {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 10px;
}

.mandatory-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 15px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Conditional Field Display */
.conditional-field {
    display: none;
    margin-top: 12px;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
    font-family: inherit;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: white;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid transparent;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border-left-color: var(--success);
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border-left-color: var(--danger);
}

/* Tables and Data Presentation */
.table-responsive {
    overflow-x: auto;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: #f1f5f9;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: #334155;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending {
    background-color: var(--warning-light);
    color: #92400e;
}

.badge-progress {
    background-color: var(--info-light);
    color: #0369a1;
}

.badge-review {
    background-color: var(--purple-light);
    color: #6b21a8;
}

.badge-revision {
    background-color: var(--danger-light);
    color: #991b1b;
}

.badge-completed {
    background-color: var(--success-light);
    color: #065f46;
}

/* Timeline/History Logs */
.timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 20px;
}

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

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-marker.success { border-color: var(--success); }
.timeline-marker.danger { border-color: var(--danger); }
.timeline-marker.warning { border-color: var(--warning); }
.timeline-marker.info { border-color: var(--info); }
.timeline-marker.purple { border-color: var(--purple); }

.timeline-content {
    background-color: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 15px 20px;
    border: 1px solid var(--border-color);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.timeline-author {
    font-weight: 600;
    color: #1e293b;
}

.timeline-time {
    color: var(--text-muted);
}

.timeline-action {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 5px;
}

.timeline-notes {
    font-size: 13.5px;
    color: #475569;
    white-space: pre-line;
}

/* Detail Page Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.info-list {
    list-style: none;
}

.info-item {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    width: 200px;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
}

.info-value {
    color: var(--text-main);
    word-break: break-word;
}

/* Utility classes */
.mt-3 { margin-top: 15px; }
.mb-3 { margin-bottom: 15px; }
.text-center { text-align: center; }
.flex-space { display: flex; justify-content: space-between; align-items: center; }

/* Layout with Sidebar */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid #1e293b;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #1e293b;
    text-align: center;
}

.sidebar-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    flex-grow: 1;
}

.sidebar-menu-item {
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    color: #fff;
    background-color: #1e293b;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #1e293b;
    background-color: #0b0f19;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-username {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-role {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
}

.main-layout {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    background-color: var(--bg-primary);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: fixed;
    top: 20px;
    left: 280px; /* Aligned with open sidebar edge */
    z-index: 1001;
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: var(--shadow-md);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

/* Collapsed Sidebar State styling */
.app-container.sidebar-collapsed .sidebar {
    transform: translateX(-260px);
}

.app-container.sidebar-collapsed .main-layout {
    margin-left: 0;
}

.app-container.sidebar-collapsed .sidebar-toggle-btn {
    left: 20px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 260px;
        z-index: 1000;
        transform: translateX(-260px); /* Hidden by default on mobile */
        border-right: 1px solid #1e293b;
    }
    .app-container:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0); /* Shown on mobile when drawer is active */
    }
    .main-layout {
        margin-left: 0 !important;
        padding: 20px;
        padding-top: 80px; /* Space for floating hamburger button */
    }
    .sidebar-toggle-btn {
        left: 20px !important; /* Keep left on mobile to act as menu drawer button */
    }
    .app-container:not(.sidebar-collapsed) .sidebar-toggle-btn {
        left: 280px !important; /* Float right next to active drawer on mobile */
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.full-width {
        grid-column: span 1;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}
