/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #16a34a;
    --warning: #eab308;
    --danger: #dc2626;
    --neutral: #6b7280;
    --light-gray: #f3f4f6;
    --border: #e5e7eb;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --sidebar-width: 250px;
    --top-bar-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    background-color: var(--light-gray);
    line-height: 1.6;
}

/* Page System */
.page {
    display: none;
}

.page.active {
    display: flex;
}

/* Login Page */
#login-page {
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.login-header h1 {
    color: var(--primary);
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.login-footer p {
    font-size: 12px;
    color: var(--text-light);
    padding: 12px;
    background: var(--light-gray);
    border-radius: 6px;
}

/* Main App Layout */
#main-app {
    width: 100%;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s;
}

.nav-item:hover {
    background: var(--light-gray);
}

.nav-item.active {
    background: var(--light-gray);
    border-left: 3px solid var(--primary);
    color: var(--primary);
    font-weight: 500;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

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

.user-info span {
    font-size: 14px;
    color: var(--text-light);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--top-bar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.top-bar h1 {
    font-size: 24px;
    color: var(--text-dark);
}

.top-bar-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.content-page {
    display: none;
}

.content-page.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

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

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

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

.btn-block {
    width: 100%;
}

/* Badge */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--light-gray);
    color: var(--text-dark);
    display: inline-block;
}

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

.badge.badge-warning {
    background: #fef3c7;
    color: #a16207;
}

.badge.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
    border-radius: 12px;
}

.stat-info h3 {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 14px;
    color: var(--text-light);
}

.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-section h2 {
    margin-bottom: 20px;
    font-size: 20px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 22px;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    padding: 8px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    width: 250px;
}

/* Filters Panel */
.filters-panel {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filters-panel.active {
    display: block;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.filters-header h3 {
    font-size: 18px;
}

.filters-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.filters-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 20px;
}

.page-number {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.page-number:hover {
    background: var(--light-gray);
}

.page-number.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* Data Table */
.data-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table thead {
    background: var(--light-gray);
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    font-weight: 600;
    color: var(--text-dark);
}

.data-table tbody tr {
    border-top: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--light-gray);
}

/* Org Chart */
.org-chart {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

.org-node {
    display: inline-block;
    text-align: center;
    margin: 10px 0;
    position: relative;
}

.org-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    min-width: 200px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.org-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.org-card h4 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.org-card p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.org-card .badge {
    margin-top: 8px;
}

.toggle-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.org-children {
    margin-left: 40px;
    margin-top: 20px;
    border-left: 2px solid var(--border);
    padding-left: 20px;
    transition: all 0.3s;
}

.org-children.collapsed {
    display: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-large {
    max-width: 900px;
}

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

.modal-header h3 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Employee Details Modal */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

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

.detail-section h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--light-gray);
}

.detail-label {
    font-weight: 500;
    color: var(--text-light);
}

.team-stats {
    display: flex;
    gap: 20px;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
    flex: 1;
    padding: 15px;
    background: var(--light-gray);
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.reports-list {
    max-height: 300px;
    overflow-y: auto;
}

.report-item {
    padding: 12px;
    background: var(--light-gray);
    border-radius: 6px;
    margin-bottom: 10px;
}

.report-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.report-item small {
    color: var(--text-light);
    font-size: 12px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--secondary);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

/* Placeholder */
.placeholder {
    text-align: center;
    color: var(--text-light);
    padding: 40px;
    font-size: 14px;
}

/* Error Message */
.error-message {
    background: #fee2e2;
    color: var(--danger);
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}

/* Import Page Styles - Phase 3 */
.import-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.import-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 18px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

/* Upload Area */
.upload-area {
    margin-top: 20px;
}

.upload-drop-zone {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s;
    background: var(--light-gray);
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.upload-drop-zone p {
    margin: 10px 0;
    color: var(--text-light);
}

.upload-hint {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 20px 0 !important;
}

.upload-info {
    font-size: 12px !important;
    margin-top: 15px !important;
}

/* Upload Progress */
.upload-progress {
    text-align: center;
    padding: 40px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
    width: 0%;
}

#upload-status {
    color: var(--text-light);
    font-size: 14px;
}

/* Validation Summary */
.validation-summary {
    margin-bottom: 25px;
}

.validation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.validation-stat {
    padding: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.validation-stat.success {
    background: #dcfce7;
    border-left: 4px solid var(--secondary);
}

.validation-stat.warning {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
}

.validation-stat.error {
    background: #fee2e2;
    border-left: 4px solid var(--danger);
}

.validation-stat .stat-label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.validation-stat .stat-value {
    font-size: 28px;
    font-weight: 600;
}

.validation-stat.success .stat-value {
    color: var(--secondary);
}

.validation-stat.warning .stat-value {
    color: #a16207;
}

.validation-stat.error .stat-value {
    color: var(--danger);
}

/* Validation Details Table */
.validation-details {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.validation-row-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.validation-row-status.valid {
    background: #dcfce7;
    color: var(--secondary);
}

.validation-row-status.warning {
    background: #fef3c7;
    color: #a16207;
}

.validation-row-status.error {
    background: #fee2e2;
    color: var(--danger);
}

.validation-issues {
    font-size: 13px;
}

.validation-issues .issue {
    display: block;
    margin: 3px 0;
}

.validation-issues .error-msg {
    color: var(--danger);
}

.validation-issues .warning-msg {
    color: #a16207;
}

/* Commit Section */
.commit-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.commit-warning p {
    margin: 8px 0;
    color: #78350f;
}

.commit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* Success Section */
.success-message {
    text-align: center;
    padding: 40px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 20px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.success-message h3 {
    color: var(--secondary);
    margin-bottom: 20px;
    font-size: 24px;
}

.success-stats {
    background: var(--light-gray);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.success-stats p {
    margin: 10px 0;
    font-size: 16px;
}

.success-stats strong {
    color: var(--text-dark);
    display: inline-block;
    min-width: 100px;
}

.success-stats span {
    color: var(--primary);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        transition: left 0.3s;
        z-index: 100;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .page-actions {
        flex-wrap: wrap;
    }
    
    .search-input {
        width: 100%;
    }
}
