:root {
    --primary-color: #AF886C;
    --primary-light: #C9A78E;
    --accent-color: #d4af37;
    --bg-color: #f4f7f6;
    --text-color: #333;
    --card-bg: #fff;
    --border-radius: 12px;
    --badge-width: 350px;
    --font-main: 'Cairo', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-header {
    text-align: center;
    margin-bottom: 40px;
}

.main-header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
}

.main-header h1 span {
    font-weight: 300;
    font-size: 1.8rem;
    color: #555;
}

.app-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .preview-section {
        order: 0;
    }
}

.card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.form-card h2,
.preview-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.required {
    color: red;
}

input,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.readonly-input {
    background-color: #f9f9f9;
    color: #777;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-main);
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #004d00;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #ccc;
}

.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.badge-container {
    perspective: 1000px;
    transform-origin: top center;
}

@media (max-width: 500px) {
    .badge-container {
        transform: scale(0.85);
    }
}

.badge {
    width: 396px;
    height: 559px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: center;
    border: 1px solid #eee;
}

.badge-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 20px;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    position: relative;
    z-index: 2;
}

.badge-header h3 {
    font-size: 1.2rem;
    line-height: 1.4;
    margin-bottom: 5px;
}

.event-date {
    font-size: 0.9rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 20px;
}

.badge-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -40px;
    position: relative;
    z-index: 3;
}

.badge-avatar-placeholder {
    width: 80px;
    height: 80px;
    background-color: #fff;
    border: 4px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

#previewName {
    font-size: 1.8rem;
    color: #222;
    margin-bottom: 5px;
    line-height: 1.2;
}

.badge-role {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.badge-org {
    color: #666;
    font-size: 1rem;
    margin-bottom: auto;
}

.badge-footer {
    width: 100%;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#qrcode {
    padding: 5px;
    background: #fff;
    border-radius: 8px;
}

#qrcode img {
    display: block;
}

.badge-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.decoration {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.1);
    z-index: 1;
}

.top-right {
    top: -30px;
    right: -30px;
}

.bottom-left {
    bottom: -30px;
    left: -30px;
    background: rgba(0, 100, 0, 0.05);
}

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(135deg, #ffffff 0%, #f4f7f6 100%);
    opacity: 1;
}

.floating-text {
    position: absolute;
    color: var(--primary-color);
    font-weight: bold;
    user-select: none;
    animation: floatUp linear forwards;
    white-space: nowrap;
    opacity: 0;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

@keyframes floatUp {
    0% {
        transform: translateY(110vh) rotate(0deg) scale(0.8);
        opacity: 0;
    }

    10% {
        opacity: 0.25;
    }

    90% {
        opacity: 0.25;
    }

    100% {
        transform: translateY(-20vh) rotate(15deg) scale(1.1);
        opacity: 0;
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.loader-content {
    text-align: center;
    color: var(--primary-color);
}

.loader-title {
    font-size: 2rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}