/* Arabic RTL Maintenance System Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
    direction: rtl;
}

/* Colors */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --secondary: #64748B;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #06B6D4;
    --light: #F8FAFC;
    --dark: #1E293B;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.login-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.logo-section {
    background: var(--primary);
    color: var(--white);
    padding: 2rem;
    text-align: center;
}

.logo {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.logo-section h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.logo-section p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.login-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--white);
}

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

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.select-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

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

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Navigation */
.navbar {
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
}

.user-info .fas {
    font-size: 1.5rem;
    color: var(--gray-400);
}

.user-role {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

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

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    color: var(--gray-800);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.status-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
}

.stat-icon.open { background: var(--warning); }
.stat-icon.progress { background: var(--info); }
.stat-icon.completed { background: var(--success); }
.stat-icon.total { background: var(--primary); }
.stat-icon.assigned { background: var(--secondary); }
.stat-icon.urgent { background: var(--danger); }

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.stat-info p {
    color: var(--gray-600);
    margin: 0;
    font-size: 0.9rem;
}

/* Content Sections */
.content-section {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}

.content-grid {
    display: grid;
    gap: 2rem;
}

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

.section-header h2 {
    color: var(--gray-800);
    margin: 0;
}

.filters {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
}

/* Tables */
.requests-table {
    padding: 0 2rem 2rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}

table tbody tr:hover {
    background: var(--gray-50);
}

/* Status and Priority Badges */
.status,
.priority {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status.open { background: #FEF3C7; color: #92400E; }
.status.progress { background: #DBEAFE; color: #1E40AF; }
.status.completed { background: #D1FAE5; color: #065F46; }

.priority.low { background: var(--gray-100); color: var(--gray-600); }
.priority.medium { background: #FEF3C7; color: #92400E; }
.priority.high { background: #FED7D7; color: #C53030; }  
.priority.critical { background: #FEB2B2; color: #9B2C2C; }

/* Request Cards */
.requests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.request-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

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

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.request-id {
    font-weight: 600;
    color: var(--primary);
}

.request-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.request-content h3 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.request-content p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.request-content .fas {
    width: 16px;
    color: var(--gray-400);
}

.request-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.status-select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    font-size: 0.875rem;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.chart-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.5rem;
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Forms */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.form-header {
    margin-bottom: 2rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

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

.form-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.required {
    color: var(--danger);
}

.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 2rem;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-label:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

/* Request Details */
.details-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.details-header {
    margin-bottom: 2rem;
}

.request-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.request-status {
    display: flex;
    gap: 1rem;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.details-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.details-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card,
.description-card,
.timeline-card,
.status-card,
.comments-card,
.attachments-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

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

.card-header h2 {
    margin: 0;
    color: var(--gray-800);
}

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

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-weight: 500;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.info-item span {
    color: var(--gray-800);
}

/* Timeline */
.timeline {
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-right: 60px;
    margin-bottom: 2rem;
}

.timeline-icon {
    position: absolute;
    right: 8px;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.875rem;
}

.timeline-icon.created { background: var(--primary); }
.timeline-icon.assigned { background: var(--info); }
.timeline-icon.comment { background: var(--success); }

.timeline-content h4 {
    margin: 0 0 0.5rem 0;
    color: var(--gray-800);
}

.timeline-content p {
    margin: 0 0 0.5rem 0;
    color: var(--gray-600);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Comments */
.comments-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.comment {
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.comment:last-child {
    border-bottom: none;
}

.comment-author {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.comment-author .fas {
    font-size: 1.5rem;
    color: var(--gray-400);
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-info .name {
    font-weight: 500;
    color: var(--gray-800);
}

.author-info .role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.author-info .date {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.comment p {
    margin: 0;
    color: var(--gray-600);
    padding-right: 2.25rem;
}

.add-comment {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.add-comment textarea {
    resize: vertical;
    min-height: 80px;
}

/* Attachments */
.attachments-list {
    margin-bottom: 1rem;
}

.attachment {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.attachment .fas {
    color: var(--primary);
    font-size: 1.25rem;
}

.attachment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.attachment-info .name {
    font-weight: 500;
    color: var(--gray-800);
}

.attachment-info .size {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Status Update */
.status-update {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.status-update .status-select {
    flex: 1;
}

/* Modals */
.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;
    padding: 1rem;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--gray-800);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
}

.close-btn:hover {
    color: var(--gray-600);
}

.modal-form {
    padding: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-user {
        flex-direction: column;
        gap: 0.5rem;
    }

    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

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

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

    .requests-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .charts-container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .status-filters {
        flex-wrap: wrap;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .request-title {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .timeline-item {
        padding-right: 40px;
    }

    .timeline::before {
        right: 12px;
    }

    .timeline-icon {
        right: 0;
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .login-form {
        padding: 1.5rem;
    }

    .form-card {
        padding: 1.5rem;
    }

    .modal-content {
        margin: 1rem;
    }

    .modal-form {
        padding: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .request-card {
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .form-actions,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .content-section,
    .info-card,
    .request-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --gray-200: #000000;
        --gray-300: #000000;
    }
}