/* style.css */

/* --- Generic Page Layout & Body --- */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    /* 
       Removed text-align:center here so that 
       the .container can left-align its contents 
    */
}

/* 
   .container 
   Centers itself horizontally (margin: 0 auto),
   left-aligns internal content (text-align: left),
   and sets a max-width for a white “card” background.
*/
.container {
    max-width: 1200px; /* Increase if you need more width */
    margin: 50px auto;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    text-align: left; /* all text inside is left-aligned */
}

/* --- Logo Sizing --- */
.logo {
    width: 150px;
    margin-bottom: 20px;
}

/* --- Headers, Paragraphs --- */
h1, h2, h3 {
    color: #005bac;
    margin: 10px 0;
}

p {
    font-size: 18px;
    color: #333;
}

/* --- Table for Short Links --- */
.short-links-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    table-layout: fixed; /* prevents columns shifting if URLs are long */
}

.short-links-table th,
.short-links-table td {
    padding: 10px;
    border-bottom: 1px solid #ccc;
    vertical-align: middle; /* Ensures content aligns vertically */
    /* 
       Make sure long URLs wrap instead of forcing 
       the table to overflow 
    */
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Align buttons in table cells */
.short-links-table td {
    vertical-align: middle; /* Ensures all cells align vertically */
}

/* Specific fix for the Actions column */
.short-links-table td:last-child {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align buttons to the left */
    gap: 10px; /* Space between buttons */
    vertical-align: middle; /* Ensure alignment with other cells */
}

/* --- Forms & Buttons --- */
/* All Submit Buttons */
input[type="submit"] {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    background-color: #005bac;
    color: white;
}
input[type="submit"]:hover {
    opacity: 0.9;
}

/* New: Email form on index.php */
.form-container {
    margin-top: 20px;
}
.email-form {
    max-width: 900px; /* allow a wide input on desktop */
    margin: 0; /* left-align the form inside the .container */
    width: 100%;
    box-sizing: border-box;
}
.form-container {
    /* ensure the form aligns with other container content */
    padding-left: 0;
    padding-right: 0;
}
.email-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start; /* ensure left alignment */
}
.email-row {
    width: 100%;
}
.email-input {
    flex: 1 1 auto; /* grow to take available space */
    min-width: 0; /* allow shrinking on small screens */
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    width: auto; /* avoid fixed widths that can center the control */
    max-width: 100%;
}
.primary-btn {
    flex: 0 0 auto;
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 6px;
    border: none;
    background-color: #005bac;
    color: white;
    cursor: pointer;
    min-width: 140px; /* keeps the button a consistent tappable size */
}
.primary-btn:hover { opacity: 0.95; }

/* Accessibility: visually hide labels while keeping them available to screen readers */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Responsive rules: stack on small screens */
@media (max-width: 600px) {
    .container { margin: 20px; padding: 16px; }
    .logo { width: 120px; }
    .email-row { flex-direction: column; align-items: stretch; }
    .email-input { width: 100%; }
    .primary-btn { width: 100%; margin-top: 8px; min-width: 0; }
    /* reduce gaps on small screens for tighter layout */
    .email-row { gap: 8px; }
    /* Reduce headline size on phones so layout feels balanced */
    h1 { font-size: 22px; line-height: 1.15; }
    p { font-size: 15px; }
    .container { padding-left: 14px; padding-right: 14px; }
}

/* Copy Button */
.copy-button {
    margin-top: 5px;
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.copy-button:hover {
    opacity: 0.85;
}

/* Delete Button */
.delete-button {
    background: #dc3545;
    color: white !important;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
}
.delete-button:hover {
    opacity: 0.85;
}

/* View Usage Button */
.view-usage-button {
    background-color: blue;
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    display: inline-block;
    text-align: center;
    cursor: pointer;
}
.view-usage-button:hover {
    background-color: darkblue;
}

/* Log Out Link (styled as a button) */
.logout-button {
    background: #dc3545;
    color: white !important;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
}
.logout-button:hover {
    opacity: 0.85;
}
