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

:root {
    --primary-color: #d32f2f;
    --primary-dark: #b71c1c;
    --primary-light: #ef5350;
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --dark-gray: #424242;
    --success-color: #4caf50;
    --error-color: #f44336;
    --shadow: 0 8px 32px rgba(211, 47, 47, 0.15);
    --shadow-hover: 0 12px 48px rgba(211, 47, 47, 0.25);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    color: var(--dark-gray);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 500px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

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

/* هدر */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: movePattern 20s linear infinite;
}

@keyframes movePattern {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.logo {
    width: 250px;
    height: 130px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
    padding: 10px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

/* محتوای اصلی */
.main-content {
    padding: 40px 30px;
    min-height: 400px;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* فرم ورود */
.login-form h2,
.size-section h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 22px;
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.login-form h2::after,
.size-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}

/* فرم */
.form,
.size-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field,
.select-field {
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--light-gray);
    color: var(--dark-gray);
}

.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.1);
}

.input-field::placeholder {
    color: #9e9e9e;
}

/* دکمه‌ها */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    text-align: center;
    min-height: 48px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn-secondary {
    background: var(--light-gray);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-icon {
    font-size: 18px;
}

/* پیام‌ها */
.alert {
    padding: 14px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.4s ease-out;
}

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

.alert-error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.alert-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
    line-height: 1.8;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* لینک ویرایش در پیغام موفقیت */
.alert-success .edit-link {
    color: var(--success-color);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px solid var(--success-color);
    transition: var(--transition);
    padding-bottom: 2px;
}

.alert-success .edit-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.alert-success strong {
    color: var(--success-color);
    font-weight: 700;
}

/* بخش خوش‌آمدگویی */
.welcome-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
    animation: fadeIn 0.6s ease-out;
}

.welcome-card {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.05) 0%, rgba(239, 83, 80, 0.05) 100%);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px solid rgba(211, 47, 47, 0.1);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(211, 47, 47, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-title {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.welcome-subtitle {
    color: var(--dark-gray);
    font-size: 14px;
    position: relative;
    z-index: 1;
}

/* بخش سایز */
.size-section {
    background: var(--light-gray);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 2px solid #e0e0e0;
}

.size-form {
    gap: 15px;
}

.size-display {
    margin-top: 20px;
    text-align: center;
}

.size-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.15);
    animation: slideUp 0.4s ease-out;
}

.size-label {
    color: var(--dark-gray);
    font-weight: 600;
    font-size: 14px;
}

.size-value {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
}

/* بخش خروج */
.logout-section {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.logout-section .btn {
    flex: 1;
}

/* فوتر */
.footer {
    background: var(--light-gray);
    padding: 20px;
    text-align: center;
    color: #9e9e9e;
    font-size: 13px;
    border-top: 1px solid #e0e0e0;
}

/* ریسپانسیو */
@media (max-width: 600px) {
    .container {
        max-width: 100%;
        border-radius: 0;
    }

    .header {
        padding: 30px 20px;
    }

    .logo {
        width: 250px;
        height: 130px;
    }

    .header h1 {
        font-size: 24px;
    }

    .main-content {
        padding: 30px 20px;
    }

    .welcome-card {
        padding: 25px;
    }

    .size-badge {
        flex-direction: column;
        gap: 8px;
    }

    .login-form h2,
    .size-section h3 {
        font-size: 20px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .alert {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .main-content {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 20px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .input-field,
    .select-field {
        font-size: 14px;
        padding: 12px 14px;
    }

    .logo {
        width: 80px;
        height: 100px;
    }
}