/* ============================================================================
   HR Portal - Full Stack Web Application
   Main CSS Stylesheet
   ============================================================================ */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #ea580c;
    --light-bg: #f3f4f6;
    --dark-bg: #1f2937;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

html, body {
    height: 100%;
}

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

/* ============================================================================
   Global Styles
   ============================================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

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

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

.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 15px;
    font-weight: 500;
}

.message.success {
    background-color: #dbeafe;
    color: #0c4a6e;
    border: 1px solid #7dd3fc;
}

.message.error {
    background-color: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

/* ============================================================================
   Form Styles
   ============================================================================ */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
}

/* ============================================================================
   Auth Container (Login/Register)
   ============================================================================ */

.auth-container {
    max-width: 500px;
    margin: 50px auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.logo-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.logo-section h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.logo-section p {
    opacity: 0.9;
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--light-bg);
}

.tab-button {
    flex: 1;
    padding: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: white;
}

.tab-button:hover {
    background-color: white;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.tab-content h2 {
    margin-bottom: 25px;
    color: var(--text-primary);
}

.tab-content form {
    margin-bottom: 15px;
}

.info-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 15px;
}

/* ============================================================================
   Dashboard Layout
   ============================================================================ */

.dashboard-container {
    display: flex;
    height: 100vh;
    background-color: var(--light-bg);
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--dark-bg), #111827);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.hr-badge {
    display: inline-block;
    background-color: var(--danger-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.user-info {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info p {
    margin: 8px 0;
}

.user-info .role {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.nav-item {
    display: block;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

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

.top-bar h2 {
    margin: 0;
    font-size: 24px;
}

#time-display {
    color: var(--text-secondary);
    font-size: 14px;
}

.tab-section {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.tab-section.active {
    display: block;
}

/* ============================================================================
   Ticket Cards (Applicant View)
   ============================================================================ */

.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ticket-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ticket-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.ticket-header h3 {
    margin: 0;
    font-size: 16px;
    flex: 1;
}

.ticket-type {
    background-color: #dbeafe;
    color: #0c4a6e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.ticket-date {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 10px;
}

.ticket-status {
    margin-bottom: 12px;
    font-size: 13px;
}

.ticket-preview {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.pending {
    background-color: #fef08a;
    color: #78350f;
}

.status-badge.action {
    background-color: #a5f3fc;
    color: #164e63;
}

.status-badge.resolved {
    background-color: #bbf7d0;
    color: #166534;
}

.status-badge.active {
    background-color: #bbf7d0;
    color: #166534;
}

.status-badge.inactive {
    background-color: #fed7aa;
    color: #7c2d12;
}

/* ============================================================================
   HR Tables
   ============================================================================ */

.hr-tickets-table,
.hr-users-table {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background-color: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.type-badge {
    display: inline-block;
    background-color: #fbbf24;
    color: #78350f;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

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

.filter-section input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 800px;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

.modal-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-section:last-child {
    border-bottom: none;
}

.modal-section strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-section p {
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 6px;
}

.info-grid div {
    font-size: 13px;
}

.info-grid strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.description-section {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.review-section {
    padding: 20px 0;
}

.review-section h2 {
    margin-bottom: 20px;
}

.review-section textarea {
    width: 100%;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .sidebar-header {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .user-info {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .sidebar-nav {
        flex-direction: row;
        flex: 1;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 12px;
    }

    .tickets-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        flex-direction: column;
        gap: 10px;
    }

    .top-bar h2 {
        font-size: 18px;
    }

    .modal-content {
        width: 95%;
        margin: 20% auto;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px;
    }

    .auth-container {
        margin: 30px 10px;
    }

    .logo-section {
        padding: 30px 20px;
    }

    .logo-section h1 {
        font-size: 24px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        flex: 0 0 calc(50% - 1px);
    }

    .tab-content {
        padding: 20px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 16px;
    }
}
