/* Flight School Quality & Safety Management System - Global Styles */

:root {
    --primary-color: #1a5490;
    --secondary-color: #2c7ac4;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    background: linear-gradient(135deg, #c4cced 0%, #b492d7 100%);
    min-height: 100vh;
    color: var(--dark-color);
}

/* Header */
.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo img {
    height: 60px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.1rem;
}

.header-user span {
    font-weight: 600;
    color: var(--primary-color);
}

.logout-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c82333;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.login-logo {
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 200px;
    height: auto;
}

.login-card h1 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid #c3e6cb;
}

/* Dashboard */
.dashboard-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-title {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.dashboard-card h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.dashboard-card p {
    color: #666;
    font-size: 1rem;
}

/* Admin Panel */
.admin-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.admin-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--primary-color);
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    margin: 0 0.25rem;
}

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

.btn-success:hover {
    background: #218838;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Placeholder */
.placeholder-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    text-align: center;
    color: white;
}

.placeholder-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.placeholder-container p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Admin Menu */
.admin-menu {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.menu-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
}

.menu-btn:hover {
    background: var(--light-color);
}

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

.admin-content {
    margin-top: 2rem;
}

/* Compact Form Styles */
.compact-section {
    padding: 1.5rem;
}

.compact-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group-inline {
    flex: 1;
    min-width: 150px;
}

.form-group-inline label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.form-group-inline input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-compact {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.message-compact {
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Permissions Matrix */
.permissions-matrix {
    overflow-x: auto;
    margin-top: 1rem;
}

.permissions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.permissions-table th,
.permissions-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.permissions-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.permissions-table .role-column {
    text-align: right;
    min-width: 150px;
    background: var(--primary-color);
}

.permissions-table .permission-header {
    font-size: 0.85rem;
    padding: 0.5rem;
}

.permissions-table tbody tr:hover {
    background: #f8f9fa;
}

.permissions-table input[type="radio"],
.permissions-table input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.permissions-table .role-name-input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    text-align: right;
}

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

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

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

.modal-header h2 {
    color: var(--primary-color);
    margin: 0;
}

.close-modal {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

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

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Main Header Styles */
.main-header {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    height: 60px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 600;
    color: var(--primary-color);
}

.btn-link {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn-link:hover {
    background: #c82333;
}

/* Main Content Area */
.main-content {
    min-height: calc(100vh - 100px);
    padding: 2rem 1rem;
}

.page-container {
    max-width: 1400px;
    margin: 0 auto;
}

.page-container h1 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.qms-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 1rem;
}

.menu-card {
    background: white;
    border: 2px solid #0066cc;
    border-radius: 8px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-card:hover {
    background: #0066cc;
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.3);
}

.menu-card h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

.back-button-container {
    text-align: center;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

/* Top Navigation Bar */
.top-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.top-nav-bar h1 {
    color: white;
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
}

.nav-btn {
    padding: 10px 20px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.back-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.nav-btn.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.action-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 24px;
    font-size: 1.05em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-btn.large {
    padding: 14px 28px;
    font-size: 1.15em;
}

.action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.action-btn.secondary {
    background-color: #6c757d;
    color: white;
}

.action-btn.secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.action-btn.danger {
    background-color: #dc3545;
    color: white;
}

.action-btn.danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-weight: 600;
}

/* Current Item Display */
.current-item-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background-color: white;
    border-radius: 6px;
    border: 2px solid #667eea;
}

.item-label {
    font-weight: 600;
    color: #495057;
}

.item-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
}

/* Bottom Action Bar */
.bottom-action-bar {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
}

/* Bottom Navigation Bar */
.bottom-nav-bar {
    margin-top: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bottom-nav-bar .nav-btn.back-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.bottom-nav-bar .nav-btn.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

/* Form Section Styling */
.form-section {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-section h2 {
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
    margin-top: 25px;
    margin-bottom: 15px;
}

/* Meta Line Styling */
.meta-line {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 2px solid #667eea;
}

.meta-line input[type="number"] {
    border: 2px solid #667eea;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 1.1em;
    font-weight: 600;
}

/* Footer Text Styling */
.footer-text {
    background-color: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    border: 2px solid #ffc107;
}

.signature-line {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.signature-line input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 5px 10px;
    margin: 0 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .qms-menu-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .login-card {
        padding: 2rem;
    }
    
    .compact-form .form-row {
        flex-direction: column;
    }
    
    .form-group-inline {
        width: 100%;
    }
    
    .permissions-matrix {
        font-size: 0.8rem;
    }
    
    .permissions-table th,
    .permissions-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .top-nav-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .top-nav-bar h1 {
        font-size: 1.4em;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .action-group {
        width: 100%;
        justify-content: center;
    }
    
    .action-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .current-item-display {
        width: 100%;
        justify-content: center;
    }
}
