/* ========================================
   Custom Bootstrap Styles - Simple & Effective
   ======================================== */

/* RTL & Font */
body {
    font-family: Tahoma, Arial, sans-serif !important;
    background-color: #f5f5f5;
}

/* ====================================
   Fieldset Cards
   ==================================== */
.fieldset-card {
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 25px;
    margin-bottom: 35px;
}

.fieldset-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 25px;
    margin: -25px -25px 25px -25px;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    text-align: center;
    font-size: 1.1em;
}

/* ====================================
   Tables - استایل برای class="head"
   ==================================== */

/* فاصله جداول - جلوگیری از چسبیدن به عناصر بالایی */
fieldset table,
.table {
    margin-top: 30px !important;
    margin-bottom: 25px !important;
}

/* فاصله fieldset ها */
fieldset {
    margin-bottom: 40px !important;
}

fieldset + fieldset {
    margin-top: 30px !important;
}

/* Header جداول با class="head" - با specificity بالا */
table th.head,
.table th.head,
th.head {
    background-color: #4F709F !important;
    background: #4F709F !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    padding: 12px 10px !important;
    text-align: center !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
}

/* td های جداول */
.table td,
.table th {
    padding: 10px 8px !important;
    vertical-align: middle !important;
}

/* Input و Select داخل جداول */
table input[type="text"],
table input[type="tel"],
table input[type="email"],
table select {
    min-width: 150px !important;
    width: 100% !important;
}

/* ====================================
   Table Responsive Wrapper
   ==================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
}

/* ====================================
   Form Controls
   ==================================== */
.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-label .required,
.text-danger {
    color: #dc3545;
}

/* ====================================
   Buttons
   ==================================== */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px 30px;
    font-weight: bold;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ====================================
   Alerts
   ==================================== */
.alert {
    border-radius: 8px;
    border: none;
}

/* ====================================
   Lightbox
   ==================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none !important;
}

.lightbox h3 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 40px 60px;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-size: 1.3em;
    line-height: 1.8;
}

.lightbox[style*="display: block"],
.lightbox[style*="display:block"] {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

/* ====================================
   Mobile Responsive
   ==================================== */
@media (max-width: 768px) {
    /* Fieldset */
    .fieldset-card {
        padding: 15px;
        margin-bottom: 30px;
    }
    
    .fieldset-header {
        padding: 12px 15px;
        margin: -15px -15px 25px -15px;
        font-size: 1em;
    }
    
    /* Fieldset spacing */
    fieldset {
        margin-bottom: 35px !important;
    }
    
    /* Tables */
    table {
        font-size: 0.9em;
    }
    
    /* th.head در موبایل */
    table th.head,
    .table th.head,
    th.head {
        padding: 10px 8px !important;
        font-size: 0.88em !important;
        background-color: #4F709F !important;
        color: #ffffff !important;
    }
    
    /* Input و Select عرض بیشتر در موبایل */
    table input[type="text"],
    table input[type="tel"],  
    table input[type="email"] {
        min-width: 180px !important;
        max-width: none !important;
        font-size: 0.9em !important;
        padding: 10px 8px !important;
    }
    
    /* Select ها عرض بیشتری نیاز دارند */
    table select,
    table .form-select {
        min-width: 200px !important;
        max-width: none !important;
        font-size: 0.9em !important;
        padding: 10px 8px !important;
    }
    
    /* Alerts */
    .alert {
        font-size: 0.9em;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    /* در صفحات خیلی کوچک */
    table input[type="text"],
    table input[type="tel"],
    table input[type="email"] {
        min-width: 170px !important;
        font-size: 0.88em !important;
        padding: 8px !important;
    }
    
    table select,
    table .form-select {
        min-width: 190px !important;
        font-size: 0.88em !important;
        padding: 8px !important;
    }
}
