/* static/css/style.css */
/* --- Color Palette Reference --- */
/*
  #d9c4ab - Light background (main body)
  #fef6f2 - Lighter background (card backgrounds, maybe border inner)
  #a18679 - Complementary/Accent color (maybe QR border, buttons)
  #2c3e50 - Darker primary color (headings, QR border, buttons)
  #1f1f1f - Very dark color (navbar, buttons)
  white - #ffffff
  #ccc - Light gray (borders)
  #eee - Lighter gray (separators)
  #333 - Dark gray (default text, hovers)
  #555 - Medium gray (muted text)
*/

/* General Body and Typography */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Good font choice */
    background-color: #d9c4ab; /* Background color matching a theme color */
    color: #333; /* Default text color */
    line-height: 1.6;
    scroll-behavior: smooth;
    /* Prevent horizontal scroll on small screens */
    overflow-x: hidden; /* NEW: Prevent horizontal scroll */
}

h1, h2, h3, h4, h5, h6 {
    color: #2c3e50; /* Heading color */
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* Navbar */
.navbar {
    background-color: #1f1f1f;
    padding: 1rem 2rem; /* Enhanced: Slightly more padding */
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    /* Allow wrapping of navbar items */
    flex-wrap: wrap; /* NEW: Allow navbar items to wrap */
    justify-content: space-between; /* NEW: Distribute space when not wrapped */
}

.logo {
    font-size: 1.8rem;
    color: white;
    text-decoration: none;
    font-weight: bold;
    margin-right: 30px;
    flex-shrink: 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
    /* Don't grow by default, let wrapping handle layout */
    /* flex-grow: 1; */ /* REMOVED */
    justify-content: flex-end;
    align-items: center;
     /* NEW: Add margin to push links down when wrapped */
     margin-top: 0; /* Reset default margin */
}

.nav-links li {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a:hover {
    color: #ccc;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 2px;
    background-color: white;
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Style for the logout button within the navbar list item */
.nav-links form {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.nav-links button[type="submit"] {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: white;
    font-weight: 500;
    font-size: 1.1rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.3s ease;
    text-decoration: none;
    position: relative;
}
.nav-links button[type="submit"]:hover {
    color: #ccc;
}
.nav-links button[type="submit"]::after {
     content: '';
     position: absolute;
     left: 0;
     bottom: -5px;
     width: 0;
     height: 2px;
     background-color: white;
     transition: width 0.3s ease;
}
.nav-links button[type="submit"]:hover::after {
    width: 100%;
}


/* Main Content Area (Used by base.html) */
.main-content {
    padding: 3rem 2rem;
    min-height: calc(100vh - 60px - 6rem);
    box-sizing: border-box;
    /* Ensure content doesn't overflow horizontally on small screens */
    overflow-x: hidden; /* NEW: Prevent horizontal scroll for main content */
}

/* Public Main Content Area (Used by public_base.html and scan_result.html) */
.main-content-public {
     padding: 3rem 2rem;
     min-height: 100vh;
     box-sizing: border-box;
     overflow-x: hidden; /* NEW: Prevent horizontal scroll */
}


/* Messages Framework Styling */
.messages {
    list-style: none;
    padding: 1rem;
    margin: 1rem auto;
    max-width: 700px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.messages li {
    padding: 1rem 1.5rem;
    margin-bottom: 0;
    line-height: 1.4;
}

.messages .success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.messages .error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.messages .info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}
.messages .warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}


/* Form Container (Used on Login, Register, Profile Display, Profile Edit, Scan Result) */
.form-container {
    max-width: 700px;
    margin: auto;
    background-color: white;
    padding: 3rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border: 1px solid #eee;
}

.form-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #1f1f1f;
}

/* Styles for inputs, labels, and errors within form-container */
.form-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.form-container input[type="text"],
.form-container input[type="password"],
.form-container input[type="email"],
.form-container input[type="file"],
.form-container input[type="tel"],
.form-container input[type="number"],
.form-container textarea,
.form-container select {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-container input[type="text"]:focus,
.form-container input[type="password"]:focus,
.form-container input[type="email"]:focus,
.form-container input[type="file"]:focus,
.form-container input[type="tel"]:focus,
.form-container input[type="number"]:focus,
.form-container textarea:focus,
.form-container select:focus {
    border-color: #a18679;
    box-shadow: 0 0 8px rgba(161, 134, 121, 0.3);
    outline: none;
}

.form-container .errorlist {
    color: red;
    font-size: 0.9rem;
    margin-bottom: 15px;
    list-style: none;
    padding-left: 0;
    font-weight: 500;
}

.form-container .field-error input,
.form-container .field-error select,
.form-container .field-error textarea {
    border: 2px solid red !important;
     box-shadow: none;
}

.form-container .field-error .errorlist {
    margin-top: 3px;
    font-size: 0.85em;
    font-weight: 500;
}

/* Form Button Styles */
.form-container form button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-container form button[type="submit"]:hover {
    background-color: #1f1f1f;
     box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Styles for links within the form-container */
.form-container p a {
    color: #2c3e50;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.form-container p a:hover {
    color: #1f1f1f;
}


/* ** Profile Display Page Specific Styles (profile_display.html) ** */

.profile-content-wrapper {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.profile-picture-display {
    flex-shrink: 0;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 8px solid #fef6f2;
    outline: 3px solid #a18679;
    outline-offset: 4px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    background-color: #fef6f2;
    transition: transform 0.3s ease;
}
.profile-picture-display:hover {
    transform: scale(1.03);
}

.profile-details {
    flex-grow: 1;
    /* max-width: 400px; */
}

.profile-details h3 {
     color: #2c3e50;
     margin-top: 0;
     margin-bottom: 15px;
     border-bottom: 1px solid #eee;
     padding-bottom: 5px;
}

.profile-details p {
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 1.05rem;
}

.profile-details strong {
    display: inline-block;
    width: 180px;
    margin-right: 15px;
    color: #1f1f1f;
    font-weight: 700;
}

.qr-code-display {
    display: block;
    max-width: 250px; /* Use max-width to allow scaling down */
    height: auto; /* Maintain aspect ratio */
    margin: 30px auto;
    border: 8px solid #2c3e50;
    padding: 15px;
    background-color: white;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}
.qr-code-display:hover {
    transform: scale(1.03);
}

.download-qr-button {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: #a18679;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.download-qr-button:hover {
     background-color: #8b7268;
     box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.form-container p a.button-link {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
     font-size: 1.1rem;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-top: 20px;
    margin-right: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-container p a.button-link:hover {
    background-color: #1f1f1f;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


/* ** Profile Edit Page Specific Styles (profile_edit.html) ** */

.profile-current-picture {
    display: block;
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
    border: 3px solid #fef6f2;
    padding: 5px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 50%;
    object-fit: cover;
}


/* ** Scan Result Page Specific Styles (scan_result.html) ** */

.scanned-user-picture {
    display: block;
    margin: 0 auto 25px auto;
    width: 150px;
    height: 150px;
    border-radius: 5px;
    object-fit: cover;
    border: 6px solid #fef6f2;
    outline: 3px solid #a18679;
    outline-offset: 3px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    background-color: #fef6f2;
}

/* Style for the "Call Now" button/link on scan result page */
.call-button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.call-button:hover {
    background-color: #1f1f1f;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.call-button i {
    margin-right: 8px;
}


/* ** Responsive Adjustments ** */

@media (max-width: 768px) {
    /* General adjustments */
    body {
        font-size: 15px; /* Slightly reduce base font size */
    }

    h1 { font-size: 2rem; } /* Adjust heading sizes */
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.3rem; }


    /* Adjustments for Navbar */
    .navbar {
         padding: 1rem; /* Adjust padding */
    }

    .navbar-container {
        flex-direction: column;
        align-items: flex-start;
    }
     .logo {
         margin-bottom: 10px;
         margin-right: 0;
     }
     .nav-links {
         margin-top: 10px;
         width: 100%;
         flex-direction: column;
         gap: 0.5rem;
         /* Remove flex-end justification when stacked */
         justify-content: flex-start; /* NEW: Align links to start when stacked */
         align-items: flex-start; /* NEW: Align link items to start */
     }
     .nav-links li {
         width: 100%;
     }
     .nav-links a,
     .nav-links button[type="submit"] {
         display: block;
         width: 100%;
         padding: 0.5rem 0;
         text-align: left;
         font-size: 1rem;
     }
      /* Remove the underline effect when links are stacked vertically */
     .nav-links a::after,
     .nav-links button[type="submit"]::after {
         content: none; /* REMOVED */
     }


    /* Adjustments for Main Content */
    .main-content,
    .main-content-public {
        padding: 2rem 1rem;
    }


    /* Adjustments for Form Container */
    .form-container {
        max-width: 95%;
        padding: 2rem 1.5rem;
    }

     .form-container h2 {
         margin-bottom: 1.5rem;
     }

     /* Adjust input padding/margin slightly */
     .form-container input[type="text"],
     .form-container input[type="password"],
     .form-container input[type="email"],
     .form-container input[type="file"],
     .form-container input[type="tel"],
     .form-container input[type="number"],
     .form-container textarea,
     .form-container select {
          padding: 0.8rem; /* Slightly less padding */
          margin-bottom: 1rem; /* Slightly less margin */
     }


    /* Adjustments for Profile Display Layout */
    .profile-content-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .profile-picture-display {
        width: 180px;
        height: 180px;
        border-width: 6px;
        outline-width: 2px;
        outline-offset: 3px;
    }

    .profile-details {
        width: 100%;
        text-align: left;
    }

    /* ** MODIFIED: Adjust label styling for stacking on small screens ** */
    .profile-details strong {
        width: auto; /* Remove fixed width */
        display: inline-block; /* Keep it on the same line as value if space allows */
        margin-right: 5px;
        /* Ensure alignment doesn't break on small screens */
        text-align: left; /* Explicitly align text left */
        min-width: 100px; /* Give labels a minimum width */
    }

     .profile-details p {
         font-size: 1rem; /* Slightly reduce font size */
         margin-bottom: 10px; /* Less space between detail lines */
     }


    /* Adjustments for QR Code Display */
    .qr-code-display {
         max-width: 200px;
         margin: 20px auto;
         padding: 10px;
         border-width: 6px;
    }

    /* Adjustments for Buttons and Button Links (Make them stack and be full width) */
    .form-container form button[type="submit"],
    .form-container p a.button-link,
    .download-qr-button {
        display: block; /* Make them block elements to stack */
        margin-right: 0; /* Remove right margin */
        margin-bottom: 15px; /* Add space between stacked buttons */
        width: 100%; /* Make them full width */
        box-sizing: border-box;
        text-align: center;
        font-size: 1rem;
        padding: 0.8rem 1rem;
    }
     /* Remove bottom margin from the last button/link when stacked */
    .form-container p:last-child a.button-link,
    .form-container p:last-child .download-qr-button,
    .form-container form button[type="submit"]:last-child {
        margin-bottom: 0;
    }


    /* Adjustments for Scan Result Page Picture */
    .scanned-user-picture {
        width: 120px;
        height: 120px;
        border-width: 4px;
        outline-width: 2px;
        outline-offset: 2px;
        margin-bottom: 20px;
    }

    /* Adjustments for Call Button on small screens */
     .call-button {
          display: block;
          margin-left: auto;
          margin-right: auto;
          width: auto;
          max-width: 200px; /* Still limit max width */
          font-size: 1rem;
          padding: 0.7rem 1rem;
     }


    /* Adjustments for other links in form container */
     .form-container p a:not(.button-link):not(.download-qr-button) {
         text-align: center;
         display: block;
     }


}