@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lato:wght@300;400;700&display=swap');

:root {
    --primary-color: #8e44ad;
    --secondary-color: #3498db;
    --accent-color: #f1c40f;
    --text-color: #2c3e50;
    --paper-color: #f9f6f0;
    --border-color: #d5b26e;
}

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

body {
    font-family: 'Lato', sans-serif;
    background: linear-gradient(135deg, #9741d4, #2980b9);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.container {
    width: 100%;
    max-width: 900px;
}

/* Intro Screen Styles */
#intro-screen {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

#intro-screen h1 {
    font-family: 'Cinzel', serif;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#intro-screen p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: var(--text-color);
}

.form-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--primary-color);
}

input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

#preview-container {
    text-align: center;
    margin-bottom: 20px;
}

button {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: 700;
    letter-spacing: 1px;
    display: inline-block;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Contract Screen Styles */
#contract-screen {
    width: 100%;
}

.contract-paper {
    background-color: var(--paper-color);
    background-image: 
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d5b26e' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E"),
        linear-gradient(to bottom, #f9f6f0, #f2ebe0);
    border: 12px solid transparent;
    border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cpath fill='none' stroke='%23d5b26e' stroke-width='4' d='M25,2 L2,2 L2,25 M75,2 L98,2 L98,25 M25,98 L2,98 L2,75 M75,98 L98,98 L98,75'/%3E%3C/svg%3E") 12;
    padding: 40px;
    border-radius: 2px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.contract-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}

.contract-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.contract-body {
    font-size: 1rem;
    line-height: 1.6;
}

.contract-body h3 {
    font-family: 'Cinzel', serif;
    color: var(--primary-color);
    margin: 20px 0 10px;
}

.contract-body p {
    margin-bottom: 15px;
}

.contract-body ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.contract-body li {
    margin-bottom: 10px;
}

.signature-section {
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.profile-picture-container {
    flex: 0 0 150px;
    margin-right: 20px;
}

#profileImageInContract {
    max-width: 150px;
    max-height: 150px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
}

.signature-container {
    flex: 1;
    min-width: 300px;
    margin-bottom: 20px;
}

.signature-pad {
    width: 100%;
    height: 100px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 10px;
    background-color: white;
}

#clearSignature {
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
    padding: 5px 15px;
    margin-top: 5px;
    font-size: 0.9rem;
}

.date-signed {
    flex: 0 0 100%;
    text-align: right;
    margin-top: 20px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 20px;
}

#breakContractButton {
    background: linear-gradient(to right, #e74c3c, #c0392b);
    display: flex;
    align-items: center;
}

.flame-icon {
    margin-left: 10px;
    animation: flicker 0.5s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.1); }
}

/* Celebration Screen Styles */
#celebration-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.celebration-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 40px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    max-width: 700px;
}

.celebration-content h1 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    margin-bottom: 20px;
    animation: glow 2s infinite alternate;
}

.celebration-content h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
}

.celebration-content p {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.celebration-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.return-button {
    background: linear-gradient(to right, var(--accent-color), var(--secondary-color));
    padding: 12px 25px;
}

.select-contract-button {
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
}

.return-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

@keyframes glow {
    0% { text-shadow: 0 0 10px rgba(255, 215, 0, 0.7); }
    100% { text-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 215, 0, 0.8); }
}

/* Tabs Styles */
.tabs-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid transparent;
    flex: 1 0 auto;
    min-width: 120px;
    text-align: center;
}

.tab-button:hover {
    background-color: rgba(142, 68, 173, 0.1);
    transform: translateY(0);
    box-shadow: none;
}

.tab-button.active {
    background-color: rgba(142, 68, 173, 0.2);
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.contract-selector {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0 0 15px 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.contract-option {
    padding: 15px;
    margin-bottom: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.contract-option:hover {
    background-color: rgba(142, 68, 173, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.contract-option.selected {
    background-color: rgba(142, 68, 173, 0.2);
    border-color: var(--primary-color);
}

.contract-title {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.contract-description {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .contract-paper {
        padding: 20px;
    }
    
    .contract-header h2 {
        font-size: 1.2rem;
    }
    
    .signature-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .profile-picture-container {
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .celebration-content h1 {
        font-size: 2rem;
    }
    
    .celebration-content h2 {
        font-size: 1.4rem;
    }
    
    .tab-button {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 0.8rem;
    }
    
    .contract-selector {
        padding: 15px;
    }
}

/* Burning animation */
@keyframes burn {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); filter: brightness(1); }
    70% { opacity: 0.3; filter: brightness(3) sepia(1); }
    100% { opacity: 0; transform: translateY(-100px) rotate(10deg); filter: brightness(4) sepia(1); }
}

.burning {
    animation: burn 3s forwards;
    position: relative;
}

.ember {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: orange;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
}

@keyframes ember-move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(var(--dest-x, 50px), var(--dest-y, -100px)); }
}

@keyframes ember-fade {
    0% { opacity: 1; }
    70% { opacity: 0.7; }
    100% { opacity: 0; }
}