/* עיצוב נוסף למערכת ניהול שוברי השאלת אמצע */

/* הגדרות בסיס */
:root {
    --primary-color: #166534; /* ירוק צבאי */
    --secondary-color: #059669;
    --accent-color: #2563eb;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --success-color: #16a34a;
    --gray-light: #f8fafc;
    --gray-medium: #64748b;
    --gray-dark: #1e293b;
}

/* פונטים עבריים */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@100..900&display=swap');

body {
    font-family: 'Noto Sans Hebrew', 'Arial', 'Helvetica', sans-serif;
    direction: rtl;
    text-align: right;
}

/* כפתורים מותאמים אישית */
.btn-military {
    background-color: #166534;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-military:hover {
    background-color: #14532d;
    color: white;
    text-decoration: none;
}

.btn-military-outline {
    border: 2px solid #166534;
    color: #166534;
    background-color: transparent;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

.btn-military-outline:hover {
    background-color: #166534;
    color: white;
    text-decoration: none;
}

/* כרטיסים */
.card-military {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-right: 4px solid #059669;
    padding: 1.5rem;
}

.card-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.card-status.draft {
    background-color: #f3f4f6;
    color: #1f2937;
}

.card-status.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.card-status.approved {
    background-color: #dcfce7;
    color: #166534;
}

.card-status.closed {
    background-color: #dbeafe;
    color: #1e40af;
}

/* טבלאות */
.table-military {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-military thead {
    background-color: #f9fafb;
}

.table-military th {
    padding: 0.75rem 1.5rem;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

.table-military td {
    padding: 1rem 1.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
}

.table-military tbody tr:hover {
    background-color: #f9fafb;
}

/* טפסים */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    background-color: white;
}

.form-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    background-color: white;
}

.form-select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    resize: vertical;
    background-color: white;
}

.form-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* שגיאות טופס */
.form-error {
    border-color: #fca5a5;
}

.form-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc2626;
}

/* התראות */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fed7aa;
    color: #92400e;
}

.alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* חתימה דיגיטלית */
.signature-pad {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    background-color: #ffffff;
    cursor: crosshair;
    position: relative;
}

.signature-pad:hover {
    border-color: #9ca3af;
}

.signature-pad.active {
    border-color: var(--primary-color);
    border-style: solid;
}

.signature-controls {
    @apply mt-2 flex justify-between items-center text-sm;
}

.signature-clear {
    @apply text-red-600 hover:text-red-800 cursor-pointer;
}

/* טבלת פריטים */
.items-table {
    @apply w-full border-collapse;
}

.items-table th,
.items-table td {
    @apply border border-gray-300 px-3 py-2 text-sm;
}

.items-table th {
    @apply bg-gray-100 font-semibold text-gray-700;
}

.items-table tbody tr:nth-child(even) {
    @apply bg-gray-50;
}

/* הדפסה */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .print-border {
        border: 2px solid black !important;
    }
    
    .signature-box {
        min-height: 60px;
        border: 1px solid black;
    }
    
    table {
        page-break-inside: avoid;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* אנימציות */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

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

/* Loading spinner */
.spinner {
    @apply inline-block w-4 h-4 border-2 border-gray-300 border-t-green-600 rounded-full animate-spin;
}

/* Badge עבור מספרים */
.badge {
    @apply inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-white transform translate-x-1/2 -translate-y-1/2 bg-red-600 rounded-full;
}

/* Navigation breadcrumbs */
.breadcrumb {
    @apply flex items-center space-x-2 text-sm text-gray-600 mb-4;
}

.breadcrumb-item {
    @apply hover:text-gray-800;
}

.breadcrumb-separator {
    @apply text-gray-400;
}

/* Progress bar */
.progress-bar {
    @apply w-full bg-gray-200 rounded-full h-2;
}

.progress-fill {
    @apply bg-green-600 h-2 rounded-full transition-all duration-300;
}

/* Modal */
.modal-overlay {
    @apply fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center;
}

.modal-content {
    @apply bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 max-h-screen overflow-y-auto;
}

.modal-header {
    @apply px-6 py-4 border-b border-gray-200;
}

.modal-body {
    @apply px-6 py-4;
}

.modal-footer {
    @apply px-6 py-4 border-t border-gray-200 flex justify-end space-x-reverse space-x-2;
}

/* Dropdown */
.dropdown {
    @apply relative inline-block;
}

.dropdown-content {
    @apply absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-10 border border-gray-200;
}

.dropdown-item {
    @apply block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 cursor-pointer;
}

/* Tabs */
.tabs {
    @apply border-b border-gray-200;
}

.tab-button {
    @apply px-4 py-2 text-sm font-medium text-gray-500 hover:text-gray-700 border-b-2 border-transparent hover:border-gray-300;
}

.tab-button.active {
    @apply text-green-600 border-green-600;
}

.tab-content {
    @apply py-4;
}

/* Search results */
.search-results {
    @apply absolute z-10 w-full bg-white border border-gray-300 rounded-md shadow-lg max-h-60 overflow-y-auto;
}

.search-result {
    @apply px-4 py-2 hover:bg-gray-100 cursor-pointer border-b border-gray-100 last:border-b-0;
}

.search-result:hover {
    @apply bg-gray-50;
}

/* Autocomplete suggestions */
.autocomplete-suggestions {
    @apply absolute z-20 w-full bg-white border border-gray-300 rounded-md shadow-lg max-h-60 overflow-y-auto mt-1;
}

.autocomplete-item {
    @apply px-4 py-3 hover:bg-gray-100 cursor-pointer border-b border-gray-100 last:border-b-0 transition-colors;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    @apply bg-blue-50;
}

.autocomplete-item .item-name {
    @apply font-medium text-gray-900;
}

.autocomplete-item .item-meta {
    @apply text-xs text-gray-500 mt-1;
}

.autocomplete-item .item-catalog {
    @apply text-xs text-blue-600 mt-1;
}

.autocomplete-loading {
    @apply px-4 py-3 text-center text-gray-500 text-sm;
}

.autocomplete-no-results {
    @apply px-4 py-3 text-center text-gray-400 text-sm;
}

/* File upload */
.file-upload-area {
    @apply border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors;
}

.file-upload-area.dragover {
    @apply border-green-500 bg-green-50;
}

/* Responsive utilities */
@media (max-width: 640px) {
    .table-responsive {
        @apply overflow-x-auto;
    }
    
    .mobile-stack {
        @apply flex flex-col space-y-2;
    }
    
    .mobile-hide {
        @apply hidden;
    }
    
    /* תיקון רווחים במובייל */
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }
    
    .container {
        @apply px-2 !important;
    }
    
    /* תיקון כיוון RTL במובייל */
    * {
        box-sizing: border-box;
    }
    
    .grid {
        @apply gap-2 !important;
    }
    
    /* תיקון טפסים במובייל */
    .form-input,
    .form-select,
    .form-textarea {
        @apply text-base !important; /* מונע זום במובייל */
    }
    
    /* תיקון כפתורים במובייל */
    button, .btn, a.btn {
        min-height: 44px !important;
        font-size: 16px !important;
        padding: 12px 16px !important;
    }
    
    /* כפתורי פעולה במובייל */
    .action-buttons {
        @apply space-y-3;
    }
    
    .action-buttons button,
    .action-buttons a {
        @apply w-full py-3 text-center block;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Grid של כפתורים */
    .mobile-button-grid {
        @apply grid grid-cols-1 gap-3;
    }
    
    @media (min-width: 640px) {
        .mobile-button-grid {
            @apply grid-cols-2;
        }
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .dark-mode {
        @apply bg-gray-900 text-white;
    }
    
    .dark-mode .card-military {
        @apply bg-gray-800 border-green-400;
    }
    
    .dark-mode .form-input,
    .dark-mode .form-select,
    .dark-mode .form-textarea {
        @apply bg-gray-700 border-gray-600 text-white;
    }
}

/* Accessibility improvements */
.sr-only {
    @apply absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0;
}

.focus-visible:focus {
    @apply outline-none ring-2 ring-green-500 ring-offset-2;
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    @apply bg-gray-100 rounded;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded hover:bg-gray-500;
}

/* Print-specific styles */
@page {
    margin: 2cm;
    size: A4;
}

.print-page {
    page-break-after: always;
}

.print-no-break {
    page-break-inside: avoid;
}

/* Hebrew text improvements */
.hebrew-text {
    font-family: 'Noto Sans Hebrew', 'Arial', 'Tahoma', sans-serif;
    direction: rtl;
    text-align: right;
}

.hebrew-numbers {
    direction: ltr;
    display: inline-block;
}

/* Status indicators */
.status-dot {
    @apply w-3 h-3 rounded-full inline-block ml-2;
}

.status-dot.active {
    @apply bg-green-500;
}

.status-dot.pending {
    @apply bg-yellow-500;
}

.status-dot.inactive {
    @apply bg-gray-400;
}

/* Military rank badges */
.rank-badge {
    @apply inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-green-100 text-green-800;
}

/* Unit identification */
.unit-badge {
    @apply inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800;
}

/* Footer */
.app-footer {
    background: linear-gradient(135deg, #146634c7 0%, #18a24ad6 100%);
    color: white;
    padding: 1rem 0;
    margin-top: auto;
    border-top: 3px solid #159646;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.app-footer .footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

.app-footer .copyright-symbol {
    font-size: 1rem;
    font-weight: bold;
    color: #fbbf24;
}

.app-footer .developer-info {
    color: #e5e7eb;
    font-weight: 500;
}

.app-footer .personal-number {
    background: rgba(251, 191, 36, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #fbbf24;
}

/* Ensure body has flex layout for sticky footer */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Noto Sans Hebrew', 'Arial', 'Helvetica', sans-serif;
    direction: rtl;
    text-align: right;
}

main {
    flex: 1;
}

/* Mobile footer adjustments */
@media (max-width: 640px) {
    .app-footer .footer-content {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.75rem;
    }
    
    .app-footer .personal-number {
        font-size: 0.75rem;
    }
}
