הל/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    direction: rtl;
    display: flex;
    flex-direction: column;
}

/* ------------------ */
/* Top Bar            */
/* ------------------ */
.top-bar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.user-greeting {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.button-group {
    display: flex;
    gap: 15px;
}

.button-group button {
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.button-group button:hover {
    background: linear-gradient(135deg, #219a52, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.button-group .logout {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.button-group .logout:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* ------------------ */
/* Main Wrapper       */
/* ------------------ */
.main-wrapper {
    flex: 1;
    margin-top: 70px; /* leave space for top bar */
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 100px auto 0 auto; /* added top margin to push below top-bar */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    padding: 40px;
}

.section {
    margin-bottom: 40px;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

.upload-grid-full {
    grid-column: 1 / -1;
}

.conditional-row.is-hidden {
    display: none !important;
}

/* ------------------ */
/* Form Elements      */
/* ------------------ */
.file-input-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 15px !important;
    margin-bottom: 20px;
    width: 100%;
    border: 1px dashed transparent;
    border-radius: 12px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.file-input-group.drop-zone-ready {
    cursor: copy;
}

.file-input-group.drag-over {
    border-color: #2980b9;
    background-color: #eef7ff;
}

.file-label {
    flex: 0 0 200px !important;
    font-weight: 500;
    color: #555;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input {
    flex: 1 1 0% !important; /* This is the magic that forces it to stay inside bounds */
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important; /* Prevents text from expanding the box */
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    
    /* Text formatting */
    unicode-bidi: plaintext !important;
    text-align: start !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important; /* Kills any negative margins */
}

.file-input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
}

.browse-btn {
    flex: 0 0 auto !important; /* Prevents the button from shrinking or growing */
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.2;
    min-width: 74px;
    transition: all 0.3s ease;
    white-space: nowrap;
    user-select: none;
    touch-action: manipulation;
    text-align: center;
    margin: 0 !important;
}

.full-width-btn {
    flex: 1 1 auto !important;
    width: 100%;
}

.browse-btn.full-width-btn {
    min-width: 0;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
}

.browse-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

/* ------------------ */
/* Clear Button       */
/* ------------------ */
.clear-btn {
    flex: 0 0 auto !important; /* Prevents the button from shrinking or growing */
    background: linear-gradient(135deg, #e74c3c, #c0392b); 
    color: white;
    border: none;
    padding: 10px 14px; 
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    touch-action: manipulation;
    text-align: center;
    margin: 0 !important;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* ------------------ */
/* Action Buttons     */
/* ------------------ */
.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.primary-btn {
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    user-select: none;
    touch-action: manipulation;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #219a52, #1e8449);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
}

.secondary-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    user-select: none;
    touch-action: manipulation;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.4);
}

.stop-btn {
    margin-top: 12px;
    background: linear-gradient(135deg, #c97b72, #b36a62);
    color: #fff;
    border: none;
    min-width: 180px;
    padding: 10px 36px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.stop-btn:hover {
    background: linear-gradient(135deg, #b36a62, #a55f57);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(180, 106, 98, 0.28);
}

/* ------------------ */
/* Modal Styles       */
/* ------------------ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

/* ------------------ */
/* Form Elements      */
/* ------------------ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: start;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #9b59b6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.date-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-input {
    width: 60px;
    text-align: center;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox {
    width: 20px;
    height: 20px;
    accent-color: #9b59b6;
}

/* ------------------ */
/* Progress Bar       */
/* ------------------ */
.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e1e8ed;
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #114257; 
    background-image: linear-gradient(
        45deg, 
        rgba(255, 255, 255, 0.911) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.911) 50%, 
        rgba(255, 255, 255, 0.911) 75%, 
        transparent 75%, 
        transparent
    );
    background-size: 15px 15px; 
    width: 0%;
    transition: width 0.4s ease;
    animation: progress-stripes 1s linear infinite; 
}

@keyframes progress-stripes {
    from { background-position: 15px 0; }
    to { background-position: 0 0; }
}

/* ------------------ */
/* Status Messages    */
/* ------------------ */
.status-message {
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    font-weight: 500;
    display: none;
    transition: all 0.3s ease;
}

.status-info {
    background: #f1f3f5; /* Light gray background to pop against the app gradient */
    border: 1px solid #dee2e6;
    color: #000000; 
}

.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ------------------ */
/* Icons              */
/* ------------------ */
.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ------------------ */
/* Responsive Design  */
/* ------------------ */
@media (max-width: 768px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }

    .upload-grid-full {
        grid-column: 1;
    }

    .file-input-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .main-wrapper {
        padding: 10px;
    }

    .container {
        border-radius: 15px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 20px;
    }
}

/* ------------------ */
/* File Pills         */
/* ------------------ */
.file-pills-container {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 44px;
    padding: 4px 0;
    overflow: hidden;
}

.file-pill {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
    background: #e8f4fd;
    border: 1px solid #aed6f1;
    border-radius: 20px;
    padding: 5px 8px 5px 12px;
    font-size: 13px;
    color: #2c3e50;
    max-width: 100%;
}

.file-pill-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    direction: ltr;
}

.file-pill-remove {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
    font-weight: bold;
    flex-shrink: 0;
}

.file-pill-remove:hover {
    color: #c0392b;
}