/* ===== RESET E VARIABILI ===== */
:root {
    --primary: #6EC1E4;
    --primary-dark: #5BA8CC;
    --secondary: #54595F;
    --text: #7A7A7A;
    --text-dark: #333333;
    --accent-green: #61CE70;
    --accent-red: #FF1000;
    --accent-blue: #00B8F4;
    --dark-bg: #323854;
    --dark-navy: #191D32;
    --light-bg: #F8F9FA;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    font-size: 15px;
}

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-navy) 100%);
    color: white;
    padding: 40px 20px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,50 Q300,10 600,50 T1200,50 L1200,120 L0,120 Z" fill="rgba(255,255,255,0.05)"/></svg>') no-repeat bottom;
    background-size: cover;
    pointer-events: none;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    text-align: center;
}

.logo-section {
    margin-bottom: 20px;
}

.logo {
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header h1 {
    font-size: 2.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 40px 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ===== PANELS ===== */
.search-panel,
.results-panel {
    background: white;
    border-radius: 16px;
    padding: 30px 35px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.7rem;
    color: var(--dark-bg);
    margin-bottom: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 30px;
    background: var(--primary);
    border-radius: 2px;
}

/* ===== FORM ===== */
.search-form {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 0px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 3px;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    padding: 8px 8px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition);
    background: white;
    color: var(--text-dark);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.1);
    background: #F8FCFE;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--primary-dark);
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: 12px;
    grid-column: 1 / -1;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    user-select: none;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-group input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.checkbox-group label {
    user-select: none;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
}

.btn-secondary {
    background: var(--text);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary);
}

.btn-search {
    grid-column: 1 / -1;
    padding: 9px 16px;
    font-size: 0.85rem;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--primary) 100%);
    margin-top: 2px;
}

.btn-back {
    margin-top: 30px;
    grid-column: 1 / -1;
    justify-content: center;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.btn-icon {
    font-size: 1.2em;
}

/* ===== RESULTS ===== */
.results-info {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-left: 4px solid var(--accent-green);
    color: var(--secondary);
    font-size: 0.95rem;
}

.results-info p {
    margin: 0;
    font-weight: 500;
}

.results-info strong {
    color: var(--primary);
}


/* ===== MOORINGS TABLE ===== */
.moorings-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.moorings-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.moorings-table th {
    padding: 16px 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--primary-dark);
}

.moorings-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.moorings-table tbody tr:hover {
    background: var(--light-bg);
}

.moorings-table tbody tr:last-child {
    border-bottom: none;
}

.moorings-table td {
    padding: 14px 12px;
    font-size: 0.8rem;
    color: var(--text-dark);
    text-align: center;
}

.moorings-table td:first-child {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
    text-align: center;
}

.moorings-table td:nth-child(2),
.moorings-table td:nth-child(3),
.moorings-table td:nth-child(4) {
    text-align: center;
    font-weight: 600;
    color: var(--secondary);
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-red);
    color: white;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.error-message.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
}

.error-message p {
    margin: 0;
    line-height: 1.5;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== FOOTER ===== */
.footer {
    background: var(--dark-navy);
    color: white;
    text-align: center;
    padding: 30px 20px;
    margin-top: auto;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
    .search-form {
        gap: 10px;
    }

    .search-panel,
    .results-panel {
        padding: 28px 32px;
    }

    .form-group input,
    .form-group select {
        padding: 8px 8px;
        font-size: 0.85rem;
    }

    .form-group label {
        font-size: 0.7rem;
    }
}

@media (max-width: 1024px) {
    .search-form {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .search-panel,
    .results-panel {
        padding: 26px 28px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 30px 16px;
    }

    .logo {
        height: 60px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header p {
        font-size: 0.95rem;
    }

    .main-content {
        padding: 24px 16px;
    }

    .search-panel,
    .results-panel {
        padding: 24px 20px;
    }

    .search-form {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .panel-title {
        font-size: 1.5rem;
        margin-bottom: 24px;
    }

    .moorings-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }

    .mooring-id {
        font-size: 1.5rem;
    }

    .mooring-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tabs {
        gap: 8px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .error-message {
        right: 16px;
        left: 16px;
        max-width: none;
        top: auto;
        bottom: 20px;
    }
}

@media (max-width: 768px) {
    .moorings-table {
        font-size: 0.75rem;
    }

    .moorings-table th,
    .moorings-table td {
        padding: 10px 6px;
    }

    .moorings-table th {
        font-size: 0.75rem;
    }

    .moorings-table td {
        font-size: 0.75rem;
    }

    .moorings-table td:first-child {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 24px 12px;
    }

    .logo {
        height: 50px;
    }

    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }

    .header p {
        font-size: 0.85rem;
    }

    .main-content {
        padding: 16px 12px;
    }

    .search-panel,
    .results-panel {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .panel-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .form-group input,
    .form-group select {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .search-form {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .btn-search {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .moorings-table {
        font-size: 0.7rem;
        width: 100%;
        overflow-x: visible;
    }

    .moorings-table th,
    .moorings-table td {
        padding: 8px 4px;
    }

    .moorings-table th {
        font-size: 0.65rem;
        padding: 8px 3px;
    }

    .moorings-table td {
        font-size: 0.7rem;
    }

    .moorings-table td:first-child {
        font-size: 0.75rem;
    }

    .moorings-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mooring-card {
        padding: 18px;
    }

    .mooring-id {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .detail-item {
        padding: 6px;
        font-size: 0.85rem;
    }

    .detail-value {
        font-size: 1rem;
    }

    .tabs {
        flex-direction: column;
        gap: 0;
        border-bottom: none;
        margin-bottom: 24px;
    }

    .tab-btn {
        width: 100%;
        padding: 12px 16px;
        border-bottom: 2px solid var(--border-color);
        justify-content: center;
    }

    .tab-btn.active::after {
        display: none;
    }

    .tab-btn.active {
        background: var(--light-bg);
        border-bottom-color: var(--primary);
    }

    .error-message.active {
        bottom: 16px;
        right: 12px;
        left: 12px;
    }

    .footer {
        padding: 20px 16px;
        font-size: 0.9rem;
    }

    /* Modal styles for 480px */
    .info-item {
        min-width: 75px;
        padding: 5px 6px;
        flex-direction: row;
        gap: 2px;
    }

    .info-item label {
        font-size: 0.6rem;
    }

    .info-item span {
        font-size: 0.75rem;
    }
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 850px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 35px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: white;
}

.modal-header h2 {
    font-size: 1.7rem;
    color: var(--dark-bg);
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--light-bg);
    color: var(--dark-bg);
}

.modal-body {
    padding: 24px 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-section h3 {
    font-size: 1rem;
    color: var(--dark-bg);
    font-weight: 600;
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.info-row {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.date-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-item {
    background: var(--light-bg);
    padding: 8px 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 110px;
    white-space: nowrap;
}

.date-item {
    background: var(--light-bg);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.info-item label,
.date-item label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.info-item span,
.date-item span {
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 600;
    white-space: nowrap;
}

.reservation-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reservation-form .form-group {
    display: flex;
    flex-direction: column;
}

.reservation-form label {
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reservation-form input,
.reservation-form textarea {
    padding: 12px 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    background: white;
    color: var(--text-dark);
}

.reservation-form input:focus,
.reservation-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.1);
    background: #F8FCFE;
}

.reservation-form textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    padding: 16px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: white;
}

.modal-footer .btn {
    margin: 0;
}

/* ===== RESPONSIVE MODAL ===== */
@media (max-width: 768px) {
    .modal-header {
        padding: 24px 20px;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 24px 20px;
    }

    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .info-row {
        flex-direction: column;
        gap: 8px;
    }

    .info-item {
        min-width: auto;
        padding: 6px 8px;
        flex-direction: row;
        gap: 3px;
    }

    .info-item label {
        font-size: 0.65rem;
    }

    .info-item span {
        font-size: 0.8rem;
    }

    .info-grid,
    .date-grid {
        grid-template-columns: 1fr;
    }

    .boat-dimensions {
        grid-template-columns: 1fr;
    }

    .available-spots-btn {
        padding: 14px 32px;
        font-size: 0.95rem;
    }
}

/* ===== AVAILABLE SPOTS BUTTON ===== */
.available-spots-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.available-spots-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--accent-green) 0%, #4db856 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.available-spots-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(97, 206, 112, 0.3);
}

.available-spots-btn:active {
    transform: translateY(0);
}

.spots-icon {
    font-size: 1.3rem;
}

/* ===== BOAT INFORMATION ===== */
.boat-info-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.boat-dimensions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.boat-dimension-item {
    background: var(--light-bg);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.boat-dimension-item label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
}

.boat-dimension-item span {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 600;
}

/* ===== MOORINGS TABLE CLICKABLE ===== */
.moorings-table tbody tr {
    cursor: pointer;
}

.moorings-table tbody tr:hover {
    background: rgba(110, 193, 228, 0.1);
}

/* ===== PRINT STYLES ===== */
@media print {
    .tabs,
    .btn-back,
    .search-panel {
        display: none;
    }

    .mooring-card {
        page-break-inside: avoid;
    }
}
