/*
 * Modern UI Enhancements for E-Cartela.ro
 * Overlays on top of templatemo-comparto.css
 */

/* ===== CSS Variables for easy theming ===== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #48bb78;
    --error: #fc8181;
    --warning: #f6ad55;
    --text-dark: #2d3748;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base Improvements ===== */
body {
    font-family: 'Inter', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #edf2f7 100%);
    color: var(--text-dark);
}

/* ===== Header Modernization ===== */
.tm-site-name-container {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.tm-site-name-container:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.tm-site-name-container h1 {
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.tm-nav-container {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.tm-nav-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.tm-nav-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.tm-nav-link {
    font-weight: 500;
}

.tm-nav-item.current .tm-nav-link,
.tm-nav-link:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

/* ===== Form Section Modernization ===== */
.tm-section-1-r {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 30px 35px;
    position: relative;
    overflow: hidden;
}

.tm-section-1-r::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.tm-section-1-r h2 {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

/* ===== Form Layout ===== */
.tm-section-1-r form p {
    margin-bottom: 12px;
}

.tm-section-1-r form p:last-of-type {
    margin-bottom: 0;
}

/* Form row for inline fields */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.form-col {
    flex: 1;
}

.form-col .form-control {
    width: 100%;
}

@media (max-width: 500px) {
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
}

/* ===== Form Inputs ===== */
.form-control {
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: var(--transition);
    margin-bottom: 3px;
}

.form-control:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* Select dropdown styling */
select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    padding-right: 50px;
}

/* Input validation states */
.form-control.valid {
    border-color: var(--success);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2348bb78' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.form-control.invalid {
    border-color: var(--error);
    background-color: #fff5f5;
}

select.form-control.valid {
    background-position: right 45px center, right 15px center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2348bb78' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Error message styling */
.error-message {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 3px;
    margin-bottom: 0;
    display: none;
    animation: slideDown 0.3s ease;
}

.error-message.show {
    display: block;
}

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

/* ===== Checkbox Modernization ===== */
.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-dark);
    line-height: 1.4;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ===== Submit Button ===== */
.tm-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 35px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

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

.tm-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
}

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

.tm-btn:active {
    transform: translateY(-1px);
}

.tm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== Alert Messages ===== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.4s ease;
}

.alert-success {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.alert-error {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #742a2a;
    border: 1px solid #feb2b2;
}

/* ===== Social/Feature Row ===== */
.tm-social-row {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.tm-icon-inner {
    padding: 30px;
    transition: var(--transition);
}

.tm-icon-inner:hover {
    transform: scale(1.05);
}

.tm-icon-inner i {
    transition: var(--transition);
}

.tm-icon-inner:hover i {
    transform: rotateY(180deg);
}

/* ===== Services Section ===== */
.tm-services-row .tm-box-pad {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* ===== FAQ Section ===== */
#contact {
    background: linear-gradient(135deg, var(--success) 0%, #38a169 100%);
    border-radius: var(--radius-lg);
}

.contact-info {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.contact-info:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.tm-contact-form {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.tm-btn-3 {
    background: linear-gradient(135deg, var(--success) 0%, #38a169 100%);
}

.tm-btn-3:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

/* ===== Back to Top Button ===== */
#button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    box-shadow: var(--shadow-lg);
}

#button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* ===== Footer ===== */
footer {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

footer p {
    margin-bottom: 0;
}

/* ===== Loading Spinner ===== */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

.tm-btn.loading .spinner {
    display: inline-block;
}

.tm-btn.loading {
    pointer-events: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Images ===== */
.tm-section-1-l img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.tm-section-1-l img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

.tm-section-2-r img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ===== Responsive Improvements ===== */

/* Tablet */
@media (max-width: 992px) {
    .tm-section-1-r {
        margin: 20px;
    }

    .tm-social-row {
        border-radius: var(--radius-md);
        margin: 0 10px;
    }

    .tm-about-row {
        flex-direction: column;
    }

    .tm-section-1-l {
        display: flex;
        gap: 15px;
        padding: 15px;
    }

    .tm-section-1-l img {
        width: 48%;
        height: auto;
    }

    .tm-services-row {
        flex-direction: column;
    }

    .tm-section-2-l,
    .tm-section-2-r {
        width: 100%;
    }

    .tm-contact-main {
        flex-direction: column;
        padding: 20px;
    }

    .contact-info-outer,
    .contact-form-outer {
        width: 100% !important;
        margin-bottom: 15px;
    }
}

/* Mobile Large */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px;
    }

    /* Header */
    .tm-site-header {
        flex-direction: column;
    }

    .tm-site-name-container {
        width: 100%;
        text-align: center;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .tm-site-name-container h1 {
        font-size: 1.8rem;
        padding: 15px;
    }

    .tm-nav-container {
        width: 100%;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        overflow-x: auto;
    }

    .tm-nav ul {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 5px;
        padding: 10px;
    }

    .tm-nav-item {
        flex-shrink: 0;
    }

    .tm-nav-link {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    /* Images */
    .tm-section-1-l {
        flex-direction: column;
        padding: 10px;
    }

    .tm-section-1-l img {
        width: 100%;
        max-height: 200px;
        object-fit: cover;
    }

    /* Social/Feature Icons Row */
    .tm-social-row {
        flex-wrap: wrap;
        border-radius: var(--radius-md);
    }

    .tm-icon {
        width: 50%;
        padding: 15px 10px;
    }

    .tm-icon-inner {
        padding: 15px;
    }

    .tm-icon-inner i {
        font-size: 2rem !important;
    }

    .tm-icon-inner p {
        font-size: 0.8rem;
        margin-top: 10px;
    }

    /* FAQ Section */
    #contact {
        border-radius: var(--radius-md);
        padding: 20px 10px;
    }

    .tm-contact-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .contact-info {
        padding: 20px 15px;
    }

    .contact-info p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .tm-contact-form {
        padding: 20px 15px;
    }

    /* Footer */
    footer {
        padding: 20px 15px;
        margin: 10px;
    }

    footer p {
        font-size: 0.85rem;
    }
}

/* Mobile Small */
@media (max-width: 600px) {
    .tm-section-1-r {
        padding: 25px 20px;
        margin: 10px;
        border-radius: var(--radius-md);
    }

    .tm-section-1-r h2 {
        font-size: 1.3rem;
        line-height: 1.4;
        margin-bottom: 20px;
    }

    .form-control {
        padding: 14px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    select.form-control {
        background-position: right 12px center;
        padding-right: 40px;
    }

    .tm-btn {
        padding: 16px 30px;
        width: 100%;
        font-size: 1rem;
    }

    .form-checkbox {
        font-size: 0.9rem;
    }

    .exchange-rate-info {
        font-size: 0.8rem !important;
        text-align: center;
    }

    /* Feature Icons */
    .tm-icon {
        width: 50%;
    }

    .tm-icon-inner i {
        font-size: 1.8rem !important;
    }

    .tm-icon-inner p {
        font-size: 0.75rem;
    }

    /* Back to top button */
    #button {
        width: 45px;
        height: 45px;
        right: 15px;
        bottom: 15px;
    }

    #button i {
        font-size: 1.2rem;
    }
}

/* Mobile Extra Small */
@media (max-width: 380px) {
    .tm-site-name-container h1 {
        font-size: 1.5rem;
    }

    .tm-nav-link {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .tm-section-1-r {
        padding: 20px 15px;
    }

    .tm-section-1-r h2 {
        font-size: 1.15rem;
    }

    .tm-icon {
        width: 100%;
    }

    .contact-info {
        padding: 15px 12px;
    }

    .contact-info p {
        font-size: 0.85rem;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .tm-btn {
        min-height: 50px;
    }

    .form-control {
        min-height: 50px;
    }

    .tm-nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .tm-section-1-l {
        display: none;
    }

    .tm-section-1-r {
        margin: 10px auto;
        max-width: 500px;
    }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tm-section-1-r {
    animation: fadeInUp 0.6s ease-out;
}

.tm-nav-item {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.tm-nav-item:nth-child(1) { animation-delay: 0.1s; }
.tm-nav-item:nth-child(2) { animation-delay: 0.2s; }
.tm-nav-item:nth-child(3) { animation-delay: 0.3s; }
.tm-nav-item:nth-child(4) { animation-delay: 0.4s; }

/* ===== Smooth Scrolling ===== */
html {
    scroll-behavior: smooth;
}
