:root {
    --blue: #0077cc;
    --mint: #83C5BE;
    --teal-dark: #1b4b5a;
    --dark: #333;
    --light: #f9f9ff;
    --border-radius: 12px;
    --sidebar-width: 220px;
    --card-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: var(--light);
    color: var(--dark);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

header {
    background: var(--teal-dark);
    color: var(--light);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    z-index: 1000;
}

.header-hidden {
    transform: translateY(-100%);
}

.nav-left {
    position: relative;
}

.menu-icon {
    font-size: 24px;
    cursor: pointer;
    color: var(--light);
}

.sidebar {
    background: #e0e0e0;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    z-index: 900;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    scroll-behavior: smooth;
}

.sidebar-logo {
    max-height: 25px;
    width: auto;
    margin: 15px auto;
    display: block;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--dark);
    text-decoration: none;
    font-size: 16px;
    border-bottom: 1px solid #ccc;
}

.sidebar a:last-child {
    border-bottom: none;
}

.sidebar a i {
    font-size: 18px;
}

.sidebar a:hover {
    background: var(--mint);
    color: var(--blue);
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px 15px;
    text-align: center;
    font-size: 12px;
    color: var(--dark);
}

.nav-center img.logo {
    max-height: 40px;
}

.nav-right i {
    font-size: 24px;
    color: var(--light);
    text-decoration: none;
}

main {
    flex: 1;
    width: 100%;
    padding: 20px;
    padding-top: 80px;
    padding-left: 20px;
}

footer {
    background: var(--teal-dark);
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    z-index: 1000;
    padding: 10px 0;
}

.footer-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.footer-nav a {
    color: var(--light);
    font-size: 28px;
    text-decoration: none;
}

.footer-nav a:hover {
    color: var(--mint);
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}

input, textarea, select, button {
    padding: 8px;
    margin: 5px 0;
    border: 1px solid var(--dark);
    border-radius: var(--border-radius);
}

button {
    background: var(--blue);
    color: var(--light);
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
}

button:hover {
    background: var(--mint);
}

.chat-box {
    border: 1px solid var(--dark);
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery img {
    border: 1px solid var(--dark);
    padding: 5px;
    border-radius: var(--border-radius);
}

.gallery img.thumbnail {
    border: 2px solid var(--blue);
}

.card {
    border: 1px solid var(--dark);
    padding: 10px;
    margin: 10px 0;
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--light);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card img {
    border-radius: 50%;
}

.verified {
    color: var(--blue);
    font-weight: bold;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table, th, td {
    border: 1px solid var(--dark);
}

th, td {
    padding: 10px;
    text-align: left;
}

th {
    background: var(--mint);
}

.pagination {
    margin: 20px 0 0 0;
    text-align: center;
}

.pagination button {
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
    background: var(--blue);
    color: var(--light);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.pagination button i {
    font-size: 16px;
}

.pagination button:hover {
    background: var(--mint);
    transform: scale(1.05);
}

.unread {
    background: var(--mint);
    font-weight: bold;
}

#match-container {
    position: relative;
    overflow: hidden;
}

.match.swiped-left {
    transform: translateX(-100%);
}

.match.swiped-right {
    transform: translateX(100%);
}

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
}

.match-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    justify-content: space-between;
}

.match {
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: calc(25% - 12px);
    padding: 15px;
    transition: transform 0.2s;
}

.match:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.match-image {
    flex: 0 0 120px;
    margin-bottom: 10px;
}

.match-image img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--mint);
}

.match-content {
    flex: 1;
    text-align: left;
    padding: 0 10px;
}

.match-content h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: var(--dark);
}

.match-content p {
    font-size: 14px;
    margin: 2px 0;
    color: #666;
}

.match-content .badges {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.verified-badge {
    color: var(--teal-dark);
    font-size: 1em;
}

.premium-badge {
    color: var(--teal-dark);
    font-size: 1em;
}

.match-actions {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.match-actions i {
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.match-actions .fa-heart.liked {
    color: var(--blue);
}

.match-actions .fa-heart:not(.liked) {
    color: #888;
}

.match-actions .fa-heart.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.match-actions .fa-comment.disabled {
    color: #888;
    cursor: not-allowed;
}

.match-actions .fa-comment:not(.disabled) {
    color: var(--blue);
}

.match-actions .fa-user {
    color: var(--blue);
}

.match-actions i:hover:not(.disabled) {
    color: var(--mint);
}

.success {
    color: var(--mint);
    font-weight: bold;
}

.error {
    color: red;
    font-size: 0.9em;
}

.message-container {
    margin-bottom: 15px;
}

.matches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: linear-gradient(135deg, #f9f9ff 0%, #ffe6e6 100%);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.matches-header h2 {
    font-size: 26px;
    color: var(--teal-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.matches-header h2 i {
    font-size: 22px;
    color: var(--blue);
}

#set-preferences-btn {
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 500;
    background: var(--blue);
    color: var(--light);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.2s;
}

#set-preferences-btn i {
    font-size: 16px;
}

#set-preferences-btn:hover {
    background: var(--mint);
    transform: scale(1.05);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1200;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 12px; /* Reduced from 20px to save space */
    border-radius: 0;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    height: 100vh; /* Fixed height: 80% of viewport */
    display: flex;
    flex-direction: column; /* Stack content vertically */
    overflow: hidden; /* Disable scrolling */
}

.modal-close {
    position: absolute;
    top: 8px; /* Reduced from 10px */
    right: 12px; /* Reduced from 15px */
    font-size: 24px; /* Reduced from 24px */
    cursor: pointer;
    color: var(--dark);
}

.modal-content h3 {
    font-size: 20px; /* Reduced from 20px */
    color: var(--teal-dark);
    margin-bottom: 10px; /* Reduced from 15px */
}

.form-group {
    margin-bottom: 7px; /* Reduced from 15px */
}

.form-group label {
    display: block;
    font-size: 14px; /* Reduced from 14px */
    color: var(--dark);
    margin-bottom: 4px; /* Reduced from 5px */
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px; /* Reduced from 8px */
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px; /* Reduced from 14px */
}

.form-actions {
    display: flex;
    flex-direction: row; /* Side by side for desktop */
    justify-content: space-between; /* Save on left, Cancel on right */
    gap: 8px;
    margin-top: 10px; /* Reduced from 20px */
    margin-bottom: 8px; /* Ensure bottom spacing */
}

.btn {
    padding: 6px 12px;
    font-size: 13px; /* Reduced from 13px */
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s;
    width: 48%; /* Each button takes half the width */
}

.btn-save {
    background: var(--blue);
    color: var(--light);
}

.btn-save:hover {
    background: var(--mint);
}

.btn-cancel {
    background: #ddd;
    color: var(--dark);
}

.btn-cancel:hover {
    background: #ccc;
}

/* Responsive Design */
@media (max-width: 600px) {
    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    header {
        padding: 10px;
        left: 0;
        width: 100%;
    }

    .nav-center img.logo {
        max-height: 30px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        padding-top: 60px;
        z-index: 900;
        display: flex;
        flex-direction: column;
        background: #e0e0e0;
        transform: translateX(-100%);
        visibility: hidden;
        opacity: 0;
        scroll-behavior: smooth;
        transition: transform 800ms ease-in-out, visibility 0s 800ms, opacity 800ms ease-in-out;
    }

    .sidebar.show {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        transition: transform 800ms ease-in-out, visibility 0s, opacity 800ms ease-in-out;
    }

    .sidebar-logo {
        max-height: 40px;
        margin: 10px auto;
    }

    .sidebar-footer {
        padding: 10px 15px;
    }

    main {
        padding: 10px;
        padding-top: 60px;
        padding-bottom: 46px;
        width: 100%;
        max-width: 100%;
    }

    .match-list {
        flex-direction: column;
        gap: 15px;
    }

    .match {
        width: 100%;
        padding: 10px;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .match-image {
        flex: 0 0 100px;
        margin-bottom: 0;
        margin-right: 10px;
    }

    .match-image img {
        width: 100px;
        height: 100px;
        object-fit: cover;
        border-radius: 50%;
        border: 4px solid var(--mint);
    }

    .match-content {
        flex: 1;
        text-align: left;
        padding: 0;
        min-width: 150px;
    }

    .match-content h3 {
        font-size: 16px;
        margin-bottom: 5px;
    }

    .match-content p {
        font-size: 12px;
        margin: 2px 0;
    }

    .match-actions {
        flex: 1 0 100%;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #eee;
        justify-content: space-around;
    }

    .match-actions i {
        font-size: 20px;
    }

    .footer-nav a {
        font-size: 24px; /* Increased from 20px */
    }

    footer {
        left: 0;
        width: 100%;
    }

    .pagination button {
        padding: 10px 20px;
        font-size: 16px;
        width: 100%;
        max-width: none;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
    }

    .pagination button i {
        font-size: 14px;
    }

    .matches-header {
        margin-bottom: 15px;
        padding: 8px;
    }

    .matches-header h2 {
        font-size: 22px;
        gap: 8px;
    }

    .matches-header h2 i {
        font-size: 18px;
    }

    #set-preferences-btn {
        padding: 6px 12px;
        font-size: 14px;
        gap: 6px;
    }

    #set-preferences-btn i {
        font-size: 14px;
    }

    .modal-content {
        width: 95%;
        max-width: 320px;
        padding: 8px; /* Reduced from 15px */
        border-radius: 0;
        box-sizing: border-box;
        height: 100vh; /* Fixed height: 70% of viewport */
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Disable scrolling */
    }

    .modal-content h3 {
        font-size: 18px; /* Reduced from 18px */
        margin-bottom: 10px; /* Reduced from 15px */
    }

    .form-group {
        margin-bottom: 6px; /* Reduced from 15px */
    }

    .form-group label {
        font-size: 13px; /* Reduced from 13px */
        margin-bottom: 3px; /* Reduced from 5px */
    }

    .form-group input,
    .form-group select {
        font-size: 13px; /* Reduced from 13px */
        padding: 6px; /* Reduced from 6px */
    }

    .form-actions {
        flex-direction: column; /* Vertical stacking for mobile */
        gap: 8px; /* Reduced from 8px */
        margin-top: 8px; /* Reduced from 20px */
        margin-bottom: 6px; /* Ensure bottom spacing */
    }

    .btn {
        padding: 6px 12px; /* Reduced from 6px 12px */
        font-size: 13px; /* Reduced from 13px */
        width: 100%; /* Full width for mobile */
    }
}

@media (min-width: 601px) {
    .content-wrapper {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        display: flex;
        flex-direction: column;
        background: #e0e0e0;
        border-right: 1px solid var(--dark);
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
        z-index: 900;
        scroll-behavior: smooth;
    }

    .menu-icon {
        display: none;
    }

    header {
        left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    .footer-nav a {
        font-size: 28px;
    }

    footer {
        left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    main {
        padding: 20px;
        padding-top: 80px;
        padding-left: 20px;
        padding-right: 20px;
        padding-bottom: 60px;
    }

    .match-list {
        justify-content: space-between;
    }

    .pagination button {
        padding: 10px 15px; /* Reduced from 15px 20px */
        font-size: 16px; /* Reduced from 18px */
        max-width: 300px; /* Reduced from 400px */
    }

    .pagination button i {
        font-size: 14px; /* Reduced from 16px */
    }
}