/* ========================================
   COMPLETE ISLAMIC INHERITANCE CALCULATOR
   Beautiful Design + Full Functionality
   ======================================== */

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

/* ========================================
   BODY & GLOBAL STYLES - Beautiful Background!
   ======================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5f3f 100%);
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,.03) 35px, rgba(255,255,255,.03) 70px),
        repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(255,255,255,.03) 35px, rgba(255,255,255,.03) 70px),
        linear-gradient(135deg, #1a472a 0%, #2d5f3f 50%, #1a472a 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 30%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '☪';
    position: fixed;
    font-size: 600px;
    color: rgba(212, 175, 55, 0.03);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    pointer-events: none;
    z-index: 0;
}

body.rtl {
    direction: rtl;
}

/* ========================================
   CONTAINER
   ======================================== */

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
    position: relative;
    z-index: 1;
}

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

/* ========================================
   HEADER STYLES
   ======================================== */

header {
    background: linear-gradient(135deg, #1a472a 0%, #2d5f3f 100%);
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 30% 50%, rgba(212, 175, 55, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(212, 175, 55, 0.15) 0%, transparent 50%);
    opacity: 0.5;
}

h1 {
    color: white;
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    position: relative;
    z-index: 1;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

.logo-image {
    width: 200px;
    max-height: 220px;
    height: auto;
    object-fit: contain;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
    position: relative;
    z-index: 1;
}

/* ========================================
   LANGUAGE SWITCHER
   ======================================== */

.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

/* ========================================
   BACK HOME BUTTON (Calculator Pages)
   ======================================== */

.back-home-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #1a472a;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-home-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    color: #d4af37;
}

body.rtl .back-home-btn {
    left: auto;
    right: 20px;
}

body.rtl .language-switcher {
    right: auto;
    left: 20px;
}

.language-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #1a472a;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.language-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.language-flag {
    font-size: 1.2em;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    min-width: 180px;
    max-height: 220px;
}

/* Custom scrollbar for language dropdown */
.language-dropdown::-webkit-scrollbar {
    width: 8px;
}

.language-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.language-dropdown::-webkit-scrollbar-thumb {
    background: #1a472a;
    border-radius: 10px;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
    background: #2d5f3f;
}

.language-dropdown.active {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.language-option {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.language-option:hover {
    background: #f0f7f4;
}

.language-option.active {
    background: linear-gradient(135deg, #1a472a 0%, #2d5f3f 100%);
    color: white;
}

/* ========================================
   FORM CONTENT (Main Form Page)
   ======================================== */

.form-content {
    padding: 40px;
}

.form-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #1a472a 0%, #d4af37 100%);
}

body.rtl .form-section::before {
    left: auto;
    right: 0;
}

.form-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.section-title {
    color: #495057;
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #1a472a 0%, #d4af37 100%);
    border-radius: 2px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 600;
    font-size: 0.95em;
}

/* ========================================
   INPUT FIELDS
   ======================================== */

input[type="number"], select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #2d5f3f;
    box-shadow: 0 0 0 3px rgba(45, 95, 63, 0.1);
    transform: translateY(-1px);
}

input[type="number"]:hover, select:hover {
    border-color: #2d5f3f;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* ========================================
   RADIO BUTTONS (BEAUTIFUL CUSTOM STYLE)
   ======================================== */

.radio-group {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    flex: 1;
    justify-content: center;
    position: relative;
}

.radio-item:hover {
    border-color: #2d5f3f;
    background: #f0f7f4;
    transform: translateY(-1px);
}

.radio-item input[type="radio"] {
    display: none;
}

/* SELECTED STATE - Beautiful Gradient! */
.radio-item.selected {
    background: linear-gradient(135deg, #1a472a 0%, #2d5f3f 100%);
    color: white;
    border-color: #2d5f3f;
    font-weight: 600;
}

/* ========================================
   SPOUSE SECTION
   ======================================== */

.spouse-section {
    display: none;
}

.spouse-section.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

/* ========================================
   SUBMIT BUTTON
   ======================================== */

button[type="submit"] {
    background: linear-gradient(135deg, #1a472a 0%, #d4af37 100%);
    color: white;
    padding: 16px 40px;
    border: none;
    border-radius: 50px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    display: block;
    margin: 30px auto;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(26, 71, 42, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.4);
}

button[type="submit"]:active {
    transform: translateY(0);
}

/* ========================================
   ADVICE PAGE STYLES
   ======================================== */

.guidance-content {
    padding: 40px;
}

.guidance-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    line-height: 1.8;
}

.guidance-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #1a472a 0%, #d4af37 100%);
}

body.rtl .guidance-section::before {
    left: auto;
    right: 0;
}

.guidance-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.guidance-section h2 {
    color: #1a472a;
    font-size: 1.7em;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #d4af37;
}

.guidance-section p {
    color: #495057;
    font-size: 1.05em;
    margin-bottom: 18px;
    line-height: 1.8;
}

.guidance-section ul {
    margin: 20px 0;
    padding-left: 30px;
}

body.rtl .guidance-section ul {
    padding-left: 0;
    padding-right: 30px;
}

.guidance-section li {
    color: #495057;
    font-size: 1.05em;
    margin: 15px 0;
    line-height: 1.8;
}

.warning-box {
    border-left: 5px solid #d4af37;
    background: linear-gradient(to right, rgba(212, 175, 55, 0.1) 0%, #f8f9fa 100%);
}

body.rtl .warning-box {
    border-left: none;
    border-right: 5px solid #d4af37;
}

.warning-box h2 {
    color: #d4af37;
    border-bottom-color: #d4af37;
}

/* ========================================
   BUTTON CONTAINER (Advice & Results)
   ======================================== */

.button-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 40px 0;
    padding: 0 40px;
    flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
    padding: 15px 35px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.primary-btn {
    background: linear-gradient(135deg, #1a472a 0%, #d4af37 100%);
    color: white;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.secondary-btn {
    background: white;
    color: #1a472a;
    border: 2px solid #1a472a;
}

.secondary-btn:hover {
    background: #f0f7f4;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.primary-btn:active,
.secondary-btn:active {
    transform: translateY(0);
}

/* ========================================
   RESULTS PAGE STYLES
   ======================================== */

.results-content {
    padding: 40px;
}

.results {
    background: linear-gradient(135deg, #1a472a 0%, #2d5f3f 100%);
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.results::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 30% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(212, 175, 55, 0.1) 0%, transparent 50%);
    opacity: 0.5;
    pointer-events: none;
}

.results h2 {
    color: white;
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

/* ========================================
   RESULTS TABLE
   ======================================== */

#sharesTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

#sharesTable thead tr {
    background: linear-gradient(135deg, #1a472a 0%, #2d5f3f 100%);
}

#sharesTable th {
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.rtl #sharesTable th,
body.rtl #sharesTable td {
    text-align: right;
}

#sharesTable td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
    color: #333;
}

#sharesTable tr:hover td {
    background-color: #f0f7f4;
}

#sharesTable tr:last-child td {
    border-bottom: none;
}

#sharesTable tbody tr:nth-child(even) {
    background: #f9f9f9;
}

#sharesTable tbody tr:nth-child(even):hover {
    background: #f0f7f4;
}

/* ========================================
   TOTAL AMOUNT DISPLAY
   ======================================== */

#totalAmountContainer {
    position: relative;
    z-index: 1;
    margin-top: 30px;
}

#totalAmountText {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .form-content,
    .guidance-content,
    .results-content {
        padding: 20px;
    }

    header {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .logo-image {
        width: 80px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .radio-item {
        width: 100%;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
    }

    .language-switcher {
        top: 10px;
        right: 10px;
    }

    .section-title {
        font-size: 1.1em;
    }

    .form-section,
    .guidance-section {
        padding: 20px;
    }

    .button-container {
        flex-direction: column;
        padding: 0 20px;
    }

    .primary-btn,
    .secondary-btn {
        width: 100%;
    }

    button[type="submit"] {
        font-size: 1em;
        padding: 14px 30px;
    }

    #sharesTable {
        font-size: 0.85em;
    }

    #sharesTable th,
    #sharesTable td {
        padding: 10px 8px;
    }

    body::after {
        font-size: 300px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    .form-section,
    .guidance-section {
        padding: 15px;
    }

    button[type="submit"] {
        font-size: 0.9em;
        padding: 12px 25px;
    }

    body::after {
        font-size: 200px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    body {
        background: white;
    }

    body::before,
    body::after {
        display: none;
    }
    
    .language-switcher,
    .button-container,
    button[type="submit"] {
        display: none;
    }
    
    .container {
        box-shadow: none;
    }

    .form-content,
    .guidance-section,
    .results {
        box-shadow: none;
        padding: 20px;
    }
    
    header {
        background: #1a472a !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #sharesTable {
        page-break-inside: avoid;
    }
}

/* ========================================
   UTILITIES & ANIMATIONS
   ======================================== */

html {
    scroll-behavior: smooth;
}

::selection {
    background: #d4af37;
    color: white;
}

::-moz-selection {
    background: #d4af37;
    color: white;
}

:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
a, button, input, select, .radio-item, .language-option {
    transition: all 0.3s ease;
}

/* Guidance page subtitles */
.guidance-subtitle{
    margin-top: 8px;
    margin-bottom: 12px;
    font-style: italic;
    color: #555;
    line-height: 1.5;
}

.guidance-intro{
    padding: 25px 35px 20px 35px;
    font-size: 1.05em;
    line-height: 1.7;
    color: #333;
}

.guidance-transition{
    padding: 0 35px 20px 35px;
    font-size: 1.05em;
    line-height: 1.7;
    color: #333;
}

.guidance-subtitle:empty{display:none;}
.subtitle:empty{display:none;}
