/* HRMIS Main Styles */
/* Human Resource Management Information System */

/* CSS Variables for Theme Customization */
:root {
    /* Primary Colors */
    --primary-light: #E3F2FD;
    --primary: #2196F3;
    --primary-dark: #1976D2;

    /* Secondary Colors */
    --secondary-light: #F5F5F5;
    --secondary: #9E9E9E;
    --secondary-dark: #616161;

    /* Accent Colors */
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --info: #00BCD4;

    /* Text Colors */
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-hint: #BDBDBD;

    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAFAFA;
    --bg-paper: #FFFFFF;

    /* Border & Shadow */
    --border-color: #E0E0E0;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 8px rgba(0,0,0,0.15);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 4px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* App Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.authenticated .app-container {
    display: grid;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
}

/* Header */
.app-header {
    grid-area: header;
    background: var(--primary);
    border-bottom: 1px solid var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-light);
    z-index: 100;
    color: white;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    padding: 10px 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #ffffff;
    transition: var(--transition);
    border-radius: 2px;
}

.header-title h1 {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    position: relative;
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.icon-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--error);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.user-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-name {
    font-size: 14px;
    color: white;
}

.dropdown-arrow {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--secondary-light);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

/* Sidebar - CAA Theme */
.app-sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, #003366 0%, #004080 100%);
    border-right: 1px solid #0055aa;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: visible;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(227, 220, 129, 0.244);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-title {
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow: visible;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    color: #f0f8ff;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: #FFCD11;
    color: #ffffff;
}

.nav-item.active .nav-link {
    background: rgba(255, 205, 17, 0.2);
    border-left-color: #FFCD11;
    color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    opacity: 0.95;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 14px 20px 10px;
    color: #add8e6;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.nav-divider {
    padding: 16px 20px 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Submenu Styles */
.nav-item.has-submenu {
    position: relative;
}

.nav-submenu-toggle {
    position: absolute;
    right: 8px;
    top: 8px;
    background: none;
    border: none;
    color: #e6f2ff;
    cursor: pointer;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
}

.nav-submenu-toggle:hover {
    background: rgba(173, 216, 230, 0.3);
    color: #ffffff;
}

.nav-arrow {
    font-size: 14px;
    transition: transform 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-item.has-submenu.open .nav-submenu-toggle .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    transition: max-height 0.3s ease-out;
}

.nav-item.has-submenu.open .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    list-style: none;
}

.nav-sublink {
    display: block;
    padding: 11px 20px 11px 52px;
    color: #e6f2ff;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-sublink:hover {
    background: rgba(255, 184, 0, 0.15);
    color: #ffffff;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 0;
    background: rgba(0, 0, 0, 0.15);
}

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

.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

.sidebar-user-role {
    font-size: 13px;
    color: #add8e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-version {
    font-size: 11px;
    color: #add8e6;
    text-align: center;
    font-weight: 500;
}

/* Main Content */
.app-main {
    grid-area: main;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.main-content {
    padding: 24px;
    min-height: 100%;
}

/* Content Cards */
.content-card,
.dashboard-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-light);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.dashboard-card h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 36px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

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

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

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn-block {
    width: 100%;
}

/* Development Info */
.development-info {
    margin-top: 24px;
    padding: 16px;
    background: var(--secondary-light);
    border-radius: var(--border-radius);
}

.development-info h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.development-info ul {
    margin-left: 20px;
}

.development-info li {
    margin-bottom: 4px;
    color: var(--text-secondary);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.hidden { display: none; }
.invisible { visibility: hidden; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}