* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: fadeIn 0.8s ease;
    position: relative;
    min-height: 90vh;
}

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

/* تنسيقات الدخول كزائر */
.auth-container {
    padding: 30px;
    display: block;
}

.login-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 36px;
}

.login-header .form-title {
    color: #343a40;
    font-size: 28px;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #6c757d;
    font-size: 18px;
    margin-top: 5px;
}

.input-group {
    margin-bottom: 25px;
    position: relative;
}

.input-group i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 20px;
}

.login-input {
    width: 100%;
    padding: 18px 18px 18px 55px;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.login-input:focus {
    border-color: #00b4db;
    box-shadow: 0 0 0 3px rgba(0, 180, 219, 0.2);
}

.btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 180, 219, 0.4);
}

.guest-btn {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.guest-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #155724 100%);
}

.login-note {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    border: 1px dashed #00b4db;
}

.login-note i {
    color: #00b4db;
    margin-left: 5px;
}

/* شاشة التطبيق الرئيسية */
.app-container {
    display: none;
}

.app-header {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-icon i {
    font-size: 24px;
    color: white;
}

.logo-text h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.logo-text p {
    font-size: 14px;
    opacity: 0.9;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
}

.user-info p {
    font-size: 14px;
    margin-bottom: 3px;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* التنقل في التطبيق */
.app-nav {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    overflow-x: auto;
}

.nav-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-btn.active {
    background: #00b4db;
    color: white;
    border-color: #00b4db;
}

.nav-btn:hover:not(.active) {
    border-color: #00b4db;
    color: #00b4db;
}

/* محتوى التطبيق */
.app-content {
    padding: 30px;
    min-height: 500px;
    padding-bottom: 80px;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

.page-title {
    font-size: 28px;
    margin-bottom: 20px;
    color: #343a40;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* الصفحة الرئيسية */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dashboard-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 180, 219, 0.15);
    border-color: #00b4db;
}

.card-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 30px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #343a40;
}

.card-desc {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

/* صفحة حاسبة الكلور */
.calculator-container {
    max-width: 800px;
    margin: 0 auto;
}

.step {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fbff;
    border-radius: 10px;
    border-left: 4px solid #00b4db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.step::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(0, 180, 219, 0.3), transparent);
    animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.step-title {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    color: #00b4db;
    font-size: 18px;
}

.step-number {
    background: #00b4db;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    font-weight: bold;
    font-size: 14px;
}

.main-label {
    display: block;
    margin-bottom: 12px;
    font-weight: bold;
    color: #00b4db;
    font-size: 16px;
    padding: 8px 12px;
    background: rgba(0, 180, 219, 0.1);
    border-radius: 8px;
    border-right: 3px solid #00b4db;
}

.calculator-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: #fff;
}

.calculator-input:focus {
    border-color: #00b4db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 180, 219, 0.2);
}

.tablet-options, .liquid-concentration, .other-use-concentration {
    display: none;
    padding: 12px;
    background: #e8f4ff;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px dashed #91d5ff;
    animation: fadeIn 0.5s ease;
}

.unit-selection {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.unit-btn {
    flex: 1;
    padding: 10px;
    background: #e8f4ff;
    border: 2px solid #ccc;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
}

.unit-btn.active {
    background: #00b4db;
    color: white;
    border-color: #00b4db;
}

.calculate-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: #00b4db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:hover {
    background: #0083b0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 180, 219, 0.3);
}

.result {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #e8f4ff;
    border-radius: 10px;
    border-left: 4px solid #00b4db;
    animation: slideIn 0.5s ease;
}

.result-title {
    color: #00b4db;
    text-align: center;
    margin-bottom: 15px;
    font-size: 20px;
}

.result-content {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
}

.result-highlight {
    color: #00b4db;
    font-weight: bold;
    font-size: 18px;
}

.warning {
    color: #ff6600;
    font-weight: bold;
    background: #fff4e6;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid #ffcc80;
    text-align: center;
    font-size: 14px;
}

.info {
    background: #e6f7ff;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid #91d5ff;
    font-size: 14px;
}

.table-container {
    overflow-x: auto;
    margin: 20px 0;
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 10px 12px;
    text-align: right;
    border: 1px solid #ddd;
}

th {
    background-color: #00b4db;
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f9ff;
}

.table-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    cursor: pointer;
    color: #00b4db;
    font-weight: bold;
    font-size: 15px;
}

.table-toggle i {
    margin-left: 8px;
    transition: transform 0.3s;
}

.table-toggle.active i {
    transform: rotate(180deg);
}

/* صفحة بنك الأسئلة */
.question-bank-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.quiz-title {
    font-size: 28px;
    color: #00b4db;
    margin-bottom: 10px;
}

.quiz-description {
    color: #6c757d;
    font-size: 16px;
    line-height: 1.6;
}

.quiz-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 25px;
    background: #00b4db;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    background: #0083b0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 180, 219, 0.3);
}

.control-btn.secondary {
    background: #6c757d;
}

.control-btn.secondary:hover {
    background: #5a6268;
}

.quiz-progress {
    margin-bottom: 25px;
    text-align: center;
}

.progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #00b4db;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 14px;
    color: #6c757d;
}

.question-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: none;
}

.question-container.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.question-number {
    font-size: 18px;
    font-weight: 600;
    color: #00b4db;
}

.question-timer {
    font-size: 16px;
    font-weight: 600;
    color: #00b4db;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #343a40;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.option {
    padding: 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.option:hover {
    border-color: #00b4db;
    background: #f0fdff;
}

.option.selected {
    border-color: #00b4db;
    background: #e6f7ff;
}

.option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.option.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

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

.option-label {
    width: 24px;
    height: 24px;
    border: 2px solid #6c757d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option.selected .option-label {
    border-color: #00b4db;
    background: #00b4db;
    color: white;
}

.option.correct .option-label {
    border-color: #28a745;
    background: #28a745;
    color: white;
}

.option.incorrect .option-label {
    border-color: #dc3545;
    background: #dc3545;
    color: white;
}

.option-text {
    flex: 1;
    font-size: 16px;
}

.feedback-container {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease;
}

.feedback-correct {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.feedback-incorrect {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.feedback-title {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-explanation {
    font-size: 15px;
    line-height: 1.5;
}

.question-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.navigation-buttons {
    display: flex;
    gap: 10px;
}

.nav-btn-quiz {
    padding: 10px 20px;
    background: #00b4db;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn-quiz:hover:not(:disabled) {
    background: #0083b0;
    transform: translateY(-2px);
}

.nav-btn-quiz:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.results-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: none;
    text-align: center;
}

.results-container.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.results-title {
    font-size: 28px;
    color: #00b4db;
    margin-bottom: 20px;
}

.score-display {
    font-size: 72px;
    font-weight: 700;
    color: #00b4db;
    margin: 20px 0;
}

.score-text {
    font-size: 18px;
    color: #6c757d;
    margin-bottom: 30px;
}

.results-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.result-label {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
}

.result-value {
    font-size: 24px;
    font-weight: 600;
    color: #343a40;
}

.review-questions-btn {
    padding: 12px 30px;
    background: #00b4db;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.review-questions-btn:hover {
    background: #0083b0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 180, 219, 0.3);
}

/* صفحة الملف الشخصي للزائر */
.profile-container {
    max-width: 600px;
    margin: 0 auto;
}

.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 50px;
}

.profile-info {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #343a40;
}

.info-value {
    color: #6c757d;
}

/* صفحة الإعدادات */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.settings-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #343a40;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    font-weight: 500;
    color: #343a40;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #00b4db;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* أزرار الملف الشخصي والإعدادات في الأسفل */
.bottom-buttons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

.bottom-btn {
    padding: 10px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.bottom-btn:hover {
    border-color: #00b4db;
    color: #00b4db;
    background: white;
}

/* التصميم المتجاوب */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        border-radius: 15px;
    }
    
    .app-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .user-menu {
        justify-content: center;
    }
    
    .app-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .app-content {
        padding: 20px;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .quiz-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .question-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .navigation-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .results-details {
        grid-template-columns: 1fr;
    }
    
    .bottom-buttons {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        justify-content: center;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 20px;
    }
    
    .login-container {
        padding: 20px;
    }
    
    .login-input {
        padding: 15px 15px 15px 45px;
        font-size: 15px;
    }
    
    .btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .app-nav {
        padding: 10px;
    }
    
    .nav-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .step {
        padding: 12px;
    }
    
    .step-title {
        font-size: 16px;
    }
    
    .main-label {
        font-size: 15px;
    }
    
    .question-container {
        padding: 20px;
    }
    
    .question-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .score-display {
        font-size: 48px;
    }
}