:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #f6ad55;
    --danger-color: #f56565;
    --light-bg: #f7fafc;
    --dark-text: #2d3748;
    --light-text: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--dark-text);
    overflow-x: hidden;
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ====== SCREEN SYSTEM ====== */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    z-index: 20;
    position: static;
}

.screen.exit-left {
    transform: translateX(-100%);
}

/* ====== SEARCH SCREEN ====== */
#screen-search {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.search-header {
    flex-shrink: 0;
    padding: 50px 20px 30px;
    text-align: center;
    color: white;
}

.search-header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    font-weight: 700;
}

#logo {
    cursor: pointer;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    user-select: none;
}

#logo:hover {
    transform: scale(1.05);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

#logo:active {
    transform: scale(0.98);
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

.search-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

#search-form {
    position: relative;
    margin-bottom: 30px;
}

.search-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-radius: 30px;
    padding: 12px 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.search-input i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.search-input input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--dark-text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.search-input input::placeholder {
    color: #ccc;
}

.search-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

.search-btn:active {
    transform: scale(0.9);
}

.suggestions {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 15px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 100;
    display: none;
}

.suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.suggestion-item:active {
    background: var(--light-bg);
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Recent Searches */
.recent-searches {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.recent-searches h3 {
    color: var(--dark-text);
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
    -webkit-user-select: none;
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item:active {
    background: rgba(0, 0, 0, 0.02);
}

.recent-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.recent-item i {
    color: var(--light-text);
    font-size: 1rem;
}

.recent-item-name {
    color: var(--dark-text);
    font-weight: 500;
}

.recent-item-temp {
    color: var(--light-text);
    font-size: 0.9rem;
}

/* ====== RESULTS SCREEN ====== */
#screen-results {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.results-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    color: white;
}

.back-btn,
.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

.back-btn:active,
.settings-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.weather-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 20px;
}

/* Current Section */
.current-section {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    color: white;
    backdrop-filter: blur(10px);
}

.location {
    margin-bottom: 20px;
}

.location h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.location p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.weather-today {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

#weather-icon {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.temp-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.temperature {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.description {
    font-size: 1.1rem;
    text-transform: capitalize;
    opacity: 0.95;
}

/* Hourly Forecast */
.hourly-forecast {
    margin-top: 20px;
}

.hourly-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.hourly-item {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    min-width: 70px;
}

.hourly-item-time {
    font-size: 0.85rem;
    opacity: 0.9;
}

.hourly-item-icon {
    width: 40px;
    height: 40px;
    margin: 8px auto;
}

.hourly-item-temp {
    font-size: 1rem;
    font-weight: 600;
}

/* Forecast Section */
.forecast-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    color: var(--dark-text);
}

.forecast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.forecast-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.forecast-header i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 25px;
}

.forecast-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.forecast-item:last-child {
    border-bottom: none;
}

.forecast-date {
    flex: 0 0 80px;
    color: var(--light-text);
    font-size: 0.95rem;
}

.forecast-weather {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.forecast-weather-icon {
    width: 35px;
    height: 35px;
}

.forecast-weather-desc {
    font-size: 0.9rem;
    color: var(--light-text);
}

.forecast-temp {
    flex: 0 0 60px;
    text-align: right;
    font-weight: 600;
    color: var(--dark-text);
}

/* Details Grid */
.details-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.detail-item {
    background: linear-gradient(135deg, var(--light-bg), white);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    border-left: 3px solid var(--primary-color);
}

.detail-item i {
    color: var(--primary-color);
    font-size: 1.3rem;
    display: block;
    margin-bottom: 8px;
}

.detail-item p {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-bottom: 5px;
}

.detail-item span {
    display: block;
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.95rem;
}

/* Weather Footer */
#weather-footer {
    flex-shrink: 0;
    padding: 15px;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

#weather-footer a {
    color: white;
    text-decoration: none;
}

/* Error Message */
.error {
    background: var(--danger-color);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    animation: slideDown 0.3s ease;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .search-header {
        padding: 40px 20px 25px;
    }

    .search-header h1 {
        font-size: 1.8rem;
    }

    .weather-today {
        gap: 15px;
    }

    #weather-icon {
        width: 80px;
        height: 80px;
    }

    .temperature {
        font-size: 2.5rem;
    }

    .forecast-date {
        flex: 0 0 70px;
    }

    .forecast-temp {
        flex: 0 0 50px;
    }
}

@media (max-width: 480px) {
    .search-header {
        padding: 35px 15px 20px;
    }

    .search-header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .search-content {
        padding: 15px;
    }

    .search-input {
        border-radius: 25px;
        padding: 10px 15px;
        gap: 8px;
    }

    .search-input i {
        font-size: 1rem;
    }

    .search-input input {
        font-size: 0.9rem;
    }

    .search-input input::placeholder {
        font-size: 0.85rem;
    }

    .search-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .recent-searches {
        padding: 15px;
    }

    .recent-searches h3 {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    .recent-item {
        padding: 10px 0;
    }

    .recent-item i {
        font-size: 0.9rem;
    }

    .recent-item-name {
        font-size: 0.95rem;
    }

    .recent-item-temp {
        font-size: 0.8rem;
    }

    .results-header {
        padding: 12px 15px;
    }

    .back-btn,
    .settings-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
        gap: 4px;
    }

    .weather-container {
        padding: 15px;
    }

    .current-section {
        padding: 20px;
        margin-bottom: 15px;
    }

    .location h2 {
        font-size: 1.5rem;
    }

    .location p {
        font-size: 0.85rem;
    }

    .weather-today {
        gap: 12px;
        margin-bottom: 15px;
    }

    #weather-icon {
        width: 70px;
        height: 70px;
    }

    .temperature {
        font-size: 2rem;
    }

    .description {
        font-size: 0.9rem;
    }

    .hourly-list {
        gap: 8px;
    }

    .hourly-item {
        min-width: 60px;
        padding: 10px;
    }

    .hourly-item-icon {
        width: 35px;
        height: 35px;
        margin: 6px auto;
    }

    .hourly-item-temp {
        font-size: 0.9rem;
    }

    .forecast-section {
        padding: 20px;
        margin-bottom: 15px;
    }

    .forecast-header h3 {
        font-size: 1.15rem;
    }

    .forecast-date {
        flex: 0 0 65px;
        font-size: 0.9rem;
    }

    .forecast-weather {
        flex: 1;
        min-width: 70px;
    }

    .forecast-weather-icon {
        width: 30px;
        height: 30px;
    }

    .forecast-weather-desc {
        font-size: 0.8rem;
    }

    .forecast-temp {
        flex: 0 0 45px;
        font-size: 0.95rem;
    }

    .details-section {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 15px;
        padding-top: 15px;
    }

    .detail-item {
        padding: 10px;
    }

    .detail-item i {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .detail-item p {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .detail-item span {
        font-size: 0.9rem;
    }

    #weather-footer {
        font-size: 0.75rem;
    }
}

/* Landscape */
@media (max-height: 600px) and (orientation: landscape) {
    .search-header {
        padding: 20px 15px 15px;
    }

    .search-header h1 {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }

    .current-section {
        padding: 15px;
        margin-bottom: 10px;
    }

    .weather-today {
        gap: 10px;
        margin-bottom: 10px;
    }

    #weather-icon {
        width: 60px;
        height: 60px;
    }

    .temperature {
        font-size: 1.8rem;
    }

    .forecast-section {
        padding: 15px;
    }

    .details-section {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin-top: 10px;
        padding-top: 10px;
    }

    .detail-item {
        padding: 8px;
    }
}
/* ====== MODAL - CONFIGURAÇÕES ====== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    visibility: hidden;
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--dark-text);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--light-text);
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--light-bg);
    color: var(--dark-text);
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.settings-group {
    margin-bottom: 25px;
}

.settings-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark-text);
    font-size: 0.95rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.radio-label:hover {
    background: var(--light-bg);
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: var(--primary-color);
}

.radio-label span,
.checkbox-label span {
    font-size: 0.95rem;
    color: var(--dark-text);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background: var(--light-bg);
}

.btn-primary {
    flex: 1;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Responsivo para o modal */
@media (max-width: 480px) {
    .modal {
        width: 95%;
        max-width: none;
    }

    .modal-header h2 {
        font-size: 1.3rem;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        flex-direction: column;
        padding: 15px;
    }

    .btn-primary {
        width: 100%;
    }
}