:root {
    /* Sunset Theme Color Palette */
    --primary-color: #ff8c42; /* Sunset Orange */
    --secondary-color: #ff5733; /* Stronger Orange */
    --text-color: #ffffff; /* White text for contrast */
    --text-muted-color: #e0e0e0; /* Lighter white for secondary text */
    --bg-overlay: rgba(20, 10, 40, 0.4); /* Dark purple overlay for transparency */
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.25);
    
    --font-main: 'Roboto', sans-serif;
    --font-secondary: 'Poppins', sans-serif;
}

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

html {
    scroll-padding-top: 20px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    /* أزلنا الخلفية من هنا لنضعها في طبقة منفصلة لتحسين الأداء */
    background-color: #2b5876; 
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden; /* لمنع ظهور شريط تمرير أفقي */
    z-index: 1;
}

/* طبقة الخلفية المحسنة للأداء */
body::before {
    content: "";
    position: fixed; /* تثبيت الخلفية لتخفيف الضغط عند التمرير */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(270deg, #2b5876, #4e4376, #8ea7e0, #4286f4);
    background-size: 800% 800%;
    animation: moveBackground 14s ease infinite;
    z-index: -1;
    will-change: background-position; /* يخبر المتصفح بتجهيز الموارد للحركة */
    transform: translateZ(0); /* تفعيل GPU Acceleration */
}

@keyframes moveBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}



main {
    width: 100%;
    max-width: 750px; /* Increased max-width slightly */
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 30px 20px;
}

/* Glassmorphism Effect for Sections */
.weather-card, .view-toggle, .search-section, header, footer {
    background: var(--bg-overlay);
    /* تقليل Blur قليلاً لا يؤثر على الشكل ولكنه يسرع الموقع جداً */
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    /* استخدام translateZ يضع العنصر في طبقة خاصة للمعالجة */
    transform: translateZ(0); 
    box-shadow: 0 4px 16px 0 var(--shadow-color); /* تخفيف الظل قليلاً للأداء */
    padding: 25px;
}

h3 {
    margin-bottom: 15px;
    font-size: 1.4rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* --- Header --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
}
header h1 {
    font-size: 2.2rem;
    color: var(--text-color);
    font-weight: 700;
}
header p {
    color: var(--text-muted-color);
}
#user-profile {
    background: transparent;
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
}
#user-profile:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* --- Search & Suggestions --- */
.search-section { padding: 15px; }
.search-wrapper { position: relative; }
#search-form { display: flex; gap: 10px; }
#city-input {
    flex-grow: 1;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-family: var(--font-main);
    font-size: 1rem;
    background-color: rgba(0,0,0,0.2);
    color: var(--text-color);
    border: 1px solid transparent;
    transition: all 0.3s;
}
#city-input::placeholder { color: var(--text-muted-color); }
#city-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(0,0,0,0.4);
}
#search-form button {
    padding: 0 20px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}
#search-form button:hover { background-color: var(--secondary-color); }
#suggestions-container {
    position: absolute; top: 110%; left: 0; right: 0;
    background: var(--bg-overlay); backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px; z-index: 100;
    max-height: 250px; overflow-y: auto;
}
.suggestion-item { padding: 12px 15px; cursor: pointer; transition: background-color 0.2s ease; border-bottom: 1px solid var(--glass-border); }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background-color: rgba(255, 140, 66, 0.2); }
.suggestion-item span { color: var(--text-muted-color); font-size: 0.85rem; margin-right: 5px; }

/* --- Content & View Toggles --- */
#main-content-wrapper { display: flex; flex-direction: column; gap: 25px; width: 100%; }
.hidden { display: none !important; }
.content-view { display: none; flex-direction: column; gap: 25px; }
.content-view.active { display: flex; }

.view-toggle { display: flex; gap: 10px; padding: 8px; }
.view-toggle-btn {
    flex-grow: 1; padding: 12px; background-color: transparent;
    border: none; border-radius: 15px; font-family: var(--font-main);
    font-size: 1rem; font-weight: bold; color: var(--text-muted-color);
    cursor: pointer; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.view-toggle-btn.active { background-color: var(--primary-color); color: white; }

/* --- Weather Cards --- */
.current-weather { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
#temperature { font-family: var(--font-secondary); font-size: 4.5rem; font-weight: 700; color: #fff;}
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 20px; }
.detail-item { text-align: center; }
.detail-item p { opacity: 0.8; }
.detail-item h3 { color: var(--text-color); font-size: 1.5rem; }
.hourly-forecast-container { display: flex; overflow-x: auto; gap: 15px; padding-bottom: 15px; }
.hourly-item {
    flex: 0 0 80px; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 15px 10px; border-radius: 12px; background: rgba(0,0,0,0.2);
}
.hourly-item p { font-family: var(--font-secondary); font-weight: bold; font-size: 1.2rem; }
.daily-forecast-container { display: flex; flex-direction: column; gap: 12px; }
.daily-item {
    display: grid; grid-template-columns: 1fr auto 1fr 1fr; align-items: center;
    gap: 15px; padding: 12px 15px; border-radius: 12px; background: rgba(0,0,0,0.2);
}
.daily-item span:first-child { font-weight: bold; }

/* --- Sea Weather Specific Styles --- */
/* --- Sea Weather Specific Styles --- */
.sea-notice {
    background: rgba(255, 255, 255, 0.15);
    color: #f5f5f5;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-left: 3px solid #00bcd4;
    border-radius: 6px;
    margin-bottom: 10px;
    text-align: center;
    backdrop-filter: blur(4px);
}
.sea-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}
.sea-card { background: rgba(0,0,0,0.2); border-radius: 12px; padding: 20px; text-align: center; }
.sea-card-value { font-size: 2rem; font-weight: bold; font-family: var(--font-secondary); color: var(--primary-color); }
.condition-bar {
    height: 20px;
    background: linear-gradient(to right, #63b3ed, #f1c40f, #e67e22, #e74c3c);
    border-radius: 10px;
    position: relative;
    margin-bottom: 8px;
}

.condition-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    width: 25%; /* تتغير حسب الحالة */
    transition: width 0.5s ease;
}


/* 🔹 السهم المؤشر للحالة الحالية */
.condition-pointer {
    position: absolute;
    top: -8px;
    left: 25%;
    transform: translateX(-50%);
    transition: left 0.5s ease;
    color: white;
    font-size: 1.8rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.8));
    z-index: 10;
}
/* 🔹 توزيع الكلمات بالتساوي تحت الشريط */
.condition-labels {
    display: flex;
    justify-content: space-between; /* يجعل الكلمات موزعة بالتساوي */
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #f5f5f5;
    text-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* 🔹 وصف الحالة */
.condition-description {
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    padding: 10px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-top: 10px;
}


.chart-period-toggle { display: flex; gap: 5px; background: rgba(0,0,0,0.2); padding: 5px; border-radius: 8px; }
.period-btn { padding: 8px 15px; border: none; background: transparent; color: var(--text-muted-color); border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.period-btn.active { background: var(--primary-color); color: white; }
.charts-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
  align-items: center;
}

.chart-wrapper {
  background: rgba(0,0,0,0.2);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 320px;
}

.chart-wrapper h4 {
  margin-bottom: 10px;
  font-size: 1rem;
  color: var(--text-color);
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}         

/* --- Sea Detailed Data Section --- */
.sea-detailed-data .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.data-view-toggle {
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.data-view-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted-color);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.data-view-btn.active {
    background: var(--primary-color);
    color: white;
}

.data-view-btn:hover:not(.active) {
    background: rgba(255,255,255,0.1);
}

/* Cards View */
.sea-data-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

.sea-data-cards.hidden {
    display: none;
}

.sea-forecast-card {
    background: linear-gradient(135deg, rgba(0,0,0,0.3), rgba(0,0,0,0.15));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sea-forecast-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #63b3ed, #4299e1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sea-forecast-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    border-color: var(--primary-color);
}

.sea-forecast-card:hover::before {
    opacity: 1;
}

.card-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.card-time i {
    font-size: 1rem;
}

.card-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.card-data-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-data-label {
    font-size: 0.8rem;
    color: var(--text-muted-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-data-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    font-family: var(--font-secondary);
}

.card-data-unit {
    font-size: 0.75rem;
    color: var(--text-muted-color);
    margin-left: 4px;
}

/* Scrollbar styling for cards */
.sea-data-cards::-webkit-scrollbar {
    width: 8px;
}

.sea-data-cards::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.sea-data-cards::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* --- Tables --- */
.table-container { 
    max-height: 500px; 
    overflow: auto; 
    border: 1px solid var(--glass-border); 
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
}

#sea-table-view.hidden {
    display: none;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    text-align: center; 
}

th, td { 
    padding: 14px 10px; 
}

thead { 
    background-color: rgba(0,0,0,0.4); 
    position: sticky; 
    top: 0;
    z-index: 5;
}

th {
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

tbody tr { 
    border-bottom: 1px solid var(--glass-border);
    transition: background-color 0.2s ease;
}

tbody tr:nth-child(even) { 
    background-color: rgba(0,0,0,0.15); 
}

tbody tr:hover {
    background-color: rgba(255, 140, 66, 0.15);
}

.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}



/* --- Newsletter & Forms --- */
#newsletter-form { display: flex; gap: 10px; }
#newsletter-form input {
    flex-grow: 1; padding: 12px; border-radius: 8px; border: none;
    font-family: var(--font-main); font-size: 1rem;
    background-color: rgba(0,0,0,0.2); color: var(--text-color);
}
#newsletter-form button {
    padding: 12px 20px; border: none; background-color: var(--primary-color);
    color: white; font-size: 1rem; border-radius: 8px; cursor: pointer;
}

/* --- Loader & Messages --- */
#initial-state { text-align: center; padding: 60px 0; }
#loader {
    border: 5px solid rgba(255,255,255,0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%; width: 50px; height: 50px;
    animation: spin 1s linear infinite; margin: 0 auto 15px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#error-message {
    text-align: center; background-color: rgba(231, 76, 60, 0.5);
    color: white; padding: 15px; border-radius: 12px;
}

/* --- Footer --- */
footer {
    width: 100%;
    margin-top: auto;
    padding: 50px 0;
    background-color: #111827;
    color: #9ca3af;
}
.footer-container {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}
.footer-column .footer-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 15px;
}
.footer-column .footer-about {
    font-size: 0.9rem;
    line-height: 1.6;
}
.footer-column .footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-column .footer-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}
.footer-column .footer-links a:hover {
    color: var(--primary-color);
}
.social-links {
    display: flex;
    gap: 15px;
}
.social-links .social-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #374151;
    border-radius: 50%;
    color: #9ca3af;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}
.social-links .social-icon:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}
.footer-copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #374151;
    font-size: 0.9rem;
}

/* --- Charts --- */
canvas {
    max-width: 100%;
}

/* --- Styles for Lottie icons --- */
#weather-icon lottie-player {
    width: 100px;
    height: 100px;
}

.hourly-item lottie-player {
    width: 45px;
    height: 45px;
}

.daily-item-icon lottie-player {
    width: 50px;
    height: 50px;
}



@media (max-width: 480px) {
    #newsletter-form {
        display: flex;
        gap: 8px;
    }

    #newsletter-form input {
        flex: 1;              /* يخلي input يتمدد حسب المساحة */
        padding: 10px;        /* تصغير بسيط */
        font-size: 0.9rem;
    }

    #newsletter-form button {
        padding: 10px 14px;   /* يصغر بدون ما يتشوه */
        font-size: 0.9rem;
        white-space: nowrap;  /* يمنع الزر من النزول لسطر ثاني */
    }
}



