/**
 * IKAROS Token Presale Platform - Modern Responsive Design
 * 
 * هذا الملف يحتوي على أنماط CSS للتأكد من أن واجهة المستخدم تعمل بشكل صحيح
 * على جميع أحجام الشاشات والأجهزة المختلفة (الهواتف الذكية، الأجهزة اللوحية، أجهزة الكمبيوتر).
 * 
 * الميزات:
 * - نهج متوافق مع الأجهزة المحمولة أولاً (Mobile-First Approach)
 * - استجابة كاملة لقسم Hero ومؤقت العد التنازلي
 * - دعم أحجام الشاشات الكبيرة والصغيرة جداً
 * - تحسينات لضمان سهولة النقر على الأزرار في الأجهزة المحمولة
 * - تعديلات خاصة للشاشات عالية الدقة
 */

/* ============ RESPONSIVE BREAKPOINTS (Mobile-First Approach) ============ */
/* xs: 0-575px, sm: 576-767px, md: 768-991px, lg: 992-1199px, xl: 1200px+ */

/* ==== BASE RESPONSIVE IMPROVEMENTS ==== */
img {
    max-width: 100%;
    height: auto;
}

/* Better touch targets on mobile */
@media (max-width: 992px) {
    .btn, 
    .nav-link, 
    .social-link,
    .form-control,
    .dropdown-item,
    .accordion-button {
        min-height: 44px;
    }
}

/* Prevent iOS zooming on focus */
@media (max-width: 768px) {
    input, select, textarea, button {
        font-size: 16px !important; 
    }
}

/* ==== SECTIONS RESPONSIVENESS ==== */
/* Hero Section */
@media (max-width: 1199px) {
    .hero-title {
        font-size: 3rem;
    }
}

@media (max-width: 991px) {
    .hero-section {
        padding: 7rem 0 3rem;
    }
    
    .hero-title {
        font-size: 2.8rem;
    }
    
    .hero-subtitle {
        font-size: 1.4rem;
    }
}

@media (max-width: 767px) {
    .hero-section {
        padding: 6rem 0 2rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    .hero-description {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .rotating-token {
        max-width: 70%;
        margin: 2rem auto;
    }
    
    .scroll-indicator {
        bottom: 20px;
    }
}

@media (max-width: 575px) {
    .hero-section {
        min-height: auto;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
}

/* ==== NAVIGATION RESPONSIVENESS ==== */
@media (max-width: 991px) {
    .nav-floating {
        background-color: rgba(10, 14, 31, 0.9);
        backdrop-filter: blur(8px);
        padding: 0.75rem 1rem !important;
    }
    
    /* تحسين ظهور القائمة المنسدلة وتأثيراتها */
    .navbar-collapse {
        background-color: rgba(10, 14, 31, 0.95);
        padding: 1rem;
        border-radius: 10px;
        margin-top: 0.5rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
        transition: all 0.3s ease-in-out;
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        overflow: hidden;
    }
    
    /* تأثيرات ظهور القائمة عند فتحها */
    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        margin: 0;
        border-radius: 0.25rem;
        transition: all 0.2s ease;
    }
    
    .nav-link:hover, .nav-link.active {
        background-color: rgba(255, 255, 255, 0.1);
        transform: translateX(5px);
    }
    
    .highlight-link {
        margin-top: 0.5rem;
    }
    
    /* تحسين مظهر زر التوغل */
    .navbar-toggler {
        border-color: rgba(255, 255, 255, 0.2) !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 5px !important;
        padding: 6px 8px !important;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25) !important;
    }
}

/* إصلاحات خاصة لمشكلة اختفاء زر التوغل */
@media (max-width: 576px) {
    .navbar-toggler {
        margin-right: 0 !important;
    }
    
    .navbar-brand img {
        max-height: 35px !important;
    }
    
    .nav-floating {
        padding: 0.5rem !important;
    }
}

/* تحسين مظهر عناصر القائمة */
.navbar-nav .nav-item {
    position: relative;
}

.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
    opacity: 1;
}

@media (max-width: 991px) {
    .nav-link::after {
        left: 0;
        transform: none;
    }
    
    .nav-link:hover::after,
    .nav-link.active::after {
        width: 50%;
    }
}

/* ==== COUNTDOWN TIMER RESPONSIVENESS ==== */
@media (max-width: 767px) {
    .countdown {
        gap: 10px;
    }

    .countdown-item {
        min-width: 65px;
    }
    
    .countdown-value {
        font-size: 1.8rem;
    }
}

@media (max-width: 575px) {
    .countdown {
        gap: 5px;
    }
    
    .countdown-item {
        min-width: 60px;
    }
    
    .countdown-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 420px) {
    .countdown-item {
        min-width: 50px;
    }
    
    .countdown-value {
        font-size: 1.3rem;
    }
    
    .countdown-label {
        font-size: 0.7rem;
    }
}

/* ==== PRESALE CARD RESPONSIVENESS ==== */
@media (max-width: 991px) {
    .presale-card {
        margin-bottom: 2rem;
    }
}

@media (max-width: 767px) {
    .presale-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .presale-header .badge {
        margin-top: 0.75rem;
    }
}

@media (max-width: 575px) {
    .detail-item {
        font-size: 0.9rem;
    }
}

/* ==== TOKEN SECTION RESPONSIVENESS ==== */
@media (max-width: 991px) {
    .token-info {
        margin-bottom: 2rem;
    }
    
    .distribution-chart {
        margin-top: 1rem;
    }
}

@media (max-width: 767px) {
    .token-spec {
        flex-direction: row;
        align-items: center;
    }
}

@media (max-width: 575px) {
    .token-spec {
        flex-direction: column;
        text-align: center;
    }
    
    .token-icon {
        margin: 0 auto 1rem;
    }
    
    .contract-address .input-group {
        flex-direction: column;
    }
    
    .contract-address .input-group .form-control {
        border-radius: 0.25rem !important; /* Ensure radius applies */
        margin-bottom: 0.5rem;
        width: 100%; /* Make input take full width */
        min-height: 44px; /* Ensure minimum height */
        text-overflow: ellipsis; /* Prevent text overflow issues */
        overflow: hidden; /* Hide overflowing text */
        white-space: nowrap; /* Keep address on one line */
    }

    .contract-address .input-group .btn {
        border-radius: 0.25rem !important; /* Ensure radius applies */
        width: 100%; /* Make button take full width */
        margin-top: 0; /* Remove any potential top margin */
    }

    /* Tokenomics Chart & Legend adjustments for Mobile (767px and below) - Targeting Desired Layout */
    .distribution-chart-container canvas, 
    .distribution-chart { 
        max-width: 250px !important; 
        height: auto !important;
        margin: 1rem auto 1.5rem !important; 
    }

    .token-legend {
        padding-left: 0 !important; 
        margin-top: 1.5rem !important; 
        list-style: none !important; 
        max-width: 90%; 
        margin-left: auto !important;
        margin-right: auto !important; 
    }

    .legend-item {
        display: flex !important;
        align-items: flex-start !important; 
        margin-bottom: 1rem !important; /* Adjust spacing */
        font-size: 1rem !important; 
        color: #ffffff !important; 
    }

    .legend-color-box {
        width: 15px !important; 
        height: 15px !important; 
        margin-right: 12px !important; 
        border-radius: 3px !important;
        flex-shrink: 0 !important; 
        margin-top: 5px !important; /* Align with first line */
    }

    .legend-text {
        line-height: 1.4 !important; /* Line height for the first line (Name/%) */
        flex-grow: 1;
        font-weight: 600 !important; /* Bolder Name/Percentage */
    }
    
    /* TARGET THE AMOUNT ELEMENT - ASSUMING IT'S A CHILD (e.g., span) */
    .legend-text > span, 
    .legend-text > div, /* Or maybe just a div? */
    .legend-text .token-amount /* Or specific class */
     { 
        display: block !important; /* === FORCE NEW LINE === */
        font-size: 0.9rem !important; /* Font size for amount */
        font-weight: 400 !important; /* NORMAL weight for amount */
        color: #adb5bd !important; /* Greyish color for amount */
        margin-top: 3px !important; /* Space between lines */
        padding-left: 0 !important; 
        line-height: 1.3 !important; /* Line height for the amount line */
        word-break: break-word; 
    }
}

@media (max-width: 575px) {
    .token-spec {
        flex-direction: column;
        text-align: center;
    }
    
    .token-icon {
        margin: 0 auto 1rem;
    }
    
    .contract-address .input-group {
        flex-direction: column;
    }
    
    .contract-address .input-group .form-control {
        border-radius: 0.25rem !important; /* Ensure radius applies */
        margin-bottom: 0.5rem;
        width: 100%; /* Make input take full width */
        min-height: 44px; /* Ensure minimum height */
        text-overflow: ellipsis; /* Prevent text overflow issues */
        overflow: hidden; /* Hide overflowing text */
        white-space: nowrap; /* Keep address on one line */
    }

    .contract-address .input-group .btn {
        border-radius: 0.25rem !important; /* Ensure radius applies */
        width: 100%; /* Make button take full width */
        margin-top: 0; /* Remove any potential top margin */
    }

    /* Further adjustments for very small screens (575px and below) - Targeting Desired Layout */
    .distribution-chart-container canvas,
    .distribution-chart {
        max-width: 200px !important; 
        margin-bottom: 1rem !important;
    }
    
    .token-legend {
        max-width: 95%; 
        margin-top: 1rem !important;
    }

    .legend-item {
        font-size: 0.95rem !important; /* Adjust font size */
        margin-bottom: 0.9rem !important; /* Adjust spacing */
    }

    .legend-color-box {
        width: 14px !important;
        height: 14px !important;
        margin-right: 10px !important;
        margin-top: 4px !important; /* Re-align */
    }
    
    .legend-text {
        line-height: 1.35 !important; /* Adjust line height */
    }

    .legend-text > span, 
    .legend-text > div,
    .legend-text .token-amount {
        font-size: 0.85rem !important; /* Adjust amount font size */
        margin-top: 2px !important; /* Fine-tune spacing */
        line-height: 1.25 !important; /* Adjust amount line height */
    }
}

/* ==== FEATURES & ECOSYSTEM RESPONSIVENESS ==== */
@media (max-width: 767px) {
    .feature-item, .eco-feature-card {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 575px) {
    .feature-item i, .eco-icon {
        transform: scale(0.9);
    }
    
    .feature-item h5, .eco-feature-card h4 {
        font-size: 1.1rem;
    }
}

/* ==== REFERRAL SECTION RESPONSIVENESS ==== */
@media (max-width: 767px) {
    .referral-step {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 575px) {
    .referral-step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin: 0 auto 1rem;
    }
}

/* ==== MODAL RESPONSIVENESS ==== */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal .modal-title {
        font-size: 1.25rem;
    }
    
    /* Improve margins and spacing */
    .modal .card {
        margin-bottom: 0.75rem;
    }
    
    .modal .form-group {
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 575px) {
    /* Presale modal specific improvements */
    #presaleModal .countdown-item {
        min-width: 45px;
        padding: 0.5rem 0.25rem;
    }
    
    #presaleModal .countdown-value {
        font-size: 1.2rem;
    }
    
    #presaleModal .token-price,
    #presaleModal .min-contribution,
    #presaleModal .max-contribution {
        font-size: 0.9rem;
    }
    
    /* Make presale details easier to read */
    .modal .detail-item {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .modal .detail-label {
        font-size: 0.85rem;
    }
    
    .modal .detail-value {
        font-weight: 600;
        font-size: 0.9rem;
    }
    
    /* Wallet info section */
    .wallet-balances .balance-item {
        padding: 0.75rem 0.5rem;
    }
    
    /* Button spacing and sizing */
    .modal .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Network badge visibility */
    .modal .status-badge {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Token image sizing */
    .modal .token-img {
        max-width: 120px;
        margin: 0 auto 1rem;
    }
    
    /* Center the token info in presale modals */
    .modal .token-info-container {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .modal .token-info-container h3 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .modal .token-info-container p {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
}

/* Even smaller screens */
@media (max-width: 375px) {
    /* Presale modal countdown timer */
    #presaleModal .countdown-item {
        min-width: 40px;
        padding: 0.4rem 0.2rem;
    }
    
    #presaleModal .countdown-value {
        font-size: 1.1rem;
    }
    
    #presaleModal .countdown-label {
        font-size: 0.65rem;
    }
    
    /* Further reduce font sizes */
    .modal .detail-label,
    .modal .detail-value {
        font-size: 0.8rem;
    }
    
    /* Make buttons full width on very small screens */
    .modal .btn-block-xs {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Better spacing in modals */
    .modal .modal-body {
        padding: 0.75rem;
    }
    
    /* Improve token image display */
    .modal .token-img {
        max-width: 100px;
    }
}

/* ==== FOOTER RESPONSIVENESS ==== */
@media (max-width: 767px) {
    .footer {
        text-align: center;
    }
    
    .footer h5::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-links {
        margin-bottom: 2rem;
    }
    
    .social-links {
        display: flex;
        justify-content: center;
        gap: 1rem;
    }
    
    .footer .input-group {
        max-width: 80%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ==== UTILITIES & MISC ==== */
@media (max-width: 575px) {
    .px-sm-0 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .px-sm-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* Back to Top button positioning */
    .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* ==== MEDIA QUERY FOR VERY SMALL DEVICES ==== */
@media (max-width: 359px) {
    html {
        font-size: 14px;
    }
    
    .countdown-item {
        min-width: 40px;
    }
    
    .countdown-value {
        font-size: 1.1rem;
    }
}

/* ==== HIGH DENSITY DISPLAYS ==== */
@media 
(-webkit-min-device-pixel-ratio: 2), 
(min-resolution: 192dpi) {
    /* Higher resolution images if needed */
    .hero-section {
        background-size: cover;
    }
}

/* ==== DARK MODE & LIGHT MODE SUPPORT ==== */
@media (prefers-color-scheme: dark) {
    /* These styles apply when user's system is set to dark mode */
    /* Since our default is dark mode, we don't need to add anything here */
}

@media (prefers-color-scheme: light) {
    /* These styles would apply when user's system is set to light mode */
    /* Only if we want to support a true light mode variant */
}
