/**
 * iHowz Member Portal Styles
 */

/* Hide empty paragraphs in page content containing portal */
.page-content:has(.ihowz-portal-header) > p:empty,
.page-content:has(.ihowz-portal-dashboard) > p:empty,
.page-content:has(.ihowz-profile-management) > p:empty {
    display: none;
}

.ihowz-portal-header {
    background: #fff;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 3px solid #9FC045;
}

.ihowz-portal-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ihowz-nav-item {
    padding: 12px 24px;
    background: rgba(159, 192, 69, 0.15);
    color: #263238;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.2s ease;
    border: none;
}

.ihowz-nav-item:hover {
    background: #9FC045;
    color: #fff;
}

.ihowz-nav-item.active {
    background: #9FC045;
    color: #fff;
}

.ihowz-portal-footer {
    margin-top: 50px;
    padding: 20px 0;
    border-top: 1px solid #ddd;
    text-align: center;
    color: #666;
}

/* Quick Links - full-width 4-column grid at bottom of dashboard */
.ihowz-quick-links {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.ihowz-quick-links h3 {
    margin: 0 0 20px;
    font-size: 18px;
    color: #263238;
}

.ihowz-quick-links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.ihowz-quick-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    background: #f9f9f9;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.ihowz-quick-link-card:hover {
    background: #F4F9E8;
    border-color: #9FC045;
    transform: translateY(-2px);
}

.ihowz-quick-link-icon {
    font-size: 32px;
    margin-bottom: 12px;
    line-height: 1;
}

.ihowz-quick-link-card strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
    color: #263238;
}

.ihowz-quick-link-card small {
    display: block;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

@media (max-width: 992px) {
    .ihowz-quick-links-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ihowz-quick-links-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Cards */
.ihowz-dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.ihowz-card {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(38, 50, 56, 0.08);
    border: 1px solid #F0F0F0;
}

.ihowz-card h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 500;
    color: #757575;
}

.ihowz-card .value {
    font-size: 36px;
    font-weight: 700;
    color: #263238;
}

.ihowz-card .label {
    font-size: 14px;
    color: #757575;
    margin-top: 8px;
}

/* Tables */
.ihowz-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.ihowz-table th {
    background: #f9f9f9;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

.ihowz-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.ihowz-table tr:hover {
    background: #f9f9f9;
}

/* Buttons */
.ihowz-button {
    display: inline-block;
    height: 48px;
    padding: 12px 24px;
    background: #9FC045;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
}

.ihowz-button:hover {
    background: #5F8422;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(159, 192, 69, 0.3);
}

.ihowz-button-secondary {
    background: transparent;
    color: #9FC045;
    border: 2px solid #9FC045;
}

.ihowz-button-secondary:hover {
    background: #F4F9E8;
    transform: translateY(-1px);
}

.ihowz-button-danger {
    background: #dc3545;
}

.ihowz-button-danger:hover {
    background: #c82333;
}

/* Status Badges */
.ihowz-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ihowz-status-active {
    background: #d4edda;
    color: #155724;
}

.ihowz-status-pending {
    background: #fff3cd;
    color: #856404;
}

.ihowz-status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.ihowz-status-open {
    background: #cce5ff;
    color: #004085;
}

.ihowz-status-closed {
    background: #d4edda;
    color: #155724;
}

/* Forms - Design Guide Compliant */
.ihowz-form-group {
    margin-bottom: 24px;
}

.ihowz-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 16px;
    color: #263238;
}

.ihowz-form-group input[type="text"],
.ihowz-form-group input[type="email"],
.ihowz-form-group input[type="tel"],
.ihowz-form-group input[type="password"],
.ihowz-form-group input[type="number"],
.ihowz-form-group select,
.ihowz-form-group textarea {
    width: 100%;
    height: 56px;
    padding: 16px;
    border: 1px solid #757575;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    color: #263238;
    background-color: #fff;
    transition: border-color 0.2s ease, border-width 0.2s ease, box-shadow 0.2s ease;
}

.ihowz-form-group input[type="text"]::placeholder,
.ihowz-form-group input[type="email"]::placeholder,
.ihowz-form-group input[type="tel"]::placeholder,
.ihowz-form-group input[type="password"]::placeholder,
.ihowz-form-group input[type="number"]::placeholder {
    color: #BDBDBD;
}

.ihowz-form-group input[type="text"]:focus,
.ihowz-form-group input[type="email"]:focus,
.ihowz-form-group input[type="tel"]:focus,
.ihowz-form-group input[type="password"]:focus,
.ihowz-form-group input[type="number"]:focus,
.ihowz-form-group select:focus,
.ihowz-form-group textarea:focus {
    outline: none;
    border: 2px solid #9FC045;
    box-shadow: 0 0 0 3px rgba(159, 192, 69, 0.15);
}

.ihowz-form-group textarea {
    min-height: 120px;
    height: auto;
    resize: vertical;
}

.ihowz-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239FC045' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
    cursor: pointer;
}

/* Checkbox and Radio Styling */
.ihowz-form-group input[type="checkbox"],
.ihowz-form-group input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: #9FC045;
    cursor: pointer;
}

.ihowz-form-group input[type="checkbox"] + label,
.ihowz-form-group input[type="radio"] + label {
    display: inline;
    font-weight: 400;
    cursor: pointer;
}

/* ================================================
   Profile Management Page
   ================================================ */

.ihowz-profile-management {
    max-width: 900px;
}

.ihowz-profile-management h1 {
    font-size: 32px;
    font-weight: 700;
    color: #263238;
    margin: 0 0 32px 0;
    line-height: 1.2;
}

.ihowz-profile-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ================================================
   Form Table Layout (WordPress-style forms)
   ================================================ */

.ihowz-profile-section .form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
}

.ihowz-profile-section .form-table tr {
    margin-bottom: 16px;
}

.ihowz-profile-section .form-table th {
    width: 180px;
    text-align: right;
    padding: 16px 16px 16px 0;
    font-weight: 500;
    font-size: 16px;
    color: #263238;
    vertical-align: middle;
    line-height: 1.4;
}

.ihowz-profile-section .form-table td {
    padding: 8px 0;
    vertical-align: top;
}

/* Regular text inputs in form-table */
.ihowz-profile-section .form-table .regular-text,
.ihowz-profile-section .form-table input[type="text"],
.ihowz-profile-section .form-table input[type="email"],
.ihowz-profile-section .form-table input[type="tel"],
.ihowz-profile-section .form-table input[type="password"],
.ihowz-profile-section .form-table input[type="number"],
.ihowz-profile-section .form-table select {
    width: 100%;
    max-width: 400px;
    height: 56px;
    padding: 16px;
    border: 1px solid #757575;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    color: #263238;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.ihowz-profile-section .form-table input::placeholder {
    color: #BDBDBD;
}

.ihowz-profile-section .form-table input:focus,
.ihowz-profile-section .form-table select:focus,
.ihowz-profile-section .form-table textarea:focus {
    outline: none;
    border: 2px solid #9FC045;
    box-shadow: 0 0 0 3px rgba(159, 192, 69, 0.15);
}

/* Password visibility toggle (matches the main login box in header.php).
   The .password-toggle-btn and icon rules are global in theme layout.css;
   here we cap the wrapper to the input width and reserve room for the button. */
.ihowz-profile-section .form-table .password-input-wrapper {
    position: relative;
    max-width: 400px;
}

.ihowz-profile-section .form-table .password-input-wrapper .regular-text {
    padding-right: 44px;
}

/* Select dropdown styling */
.ihowz-profile-section .form-table select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239FC045' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
    cursor: pointer;
}

/* Description text below inputs */
.ihowz-profile-section .form-table .description {
    font-size: 14px;
    color: #757575;
    margin-top: 8px;
    line-height: 1.5;
}

/* Section headings */
.ihowz-profile-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: #263238;
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e5e5;
}

/* Checkbox group rows: remove the 56px line-height so the label
   aligns with the first checkbox instead of floating mid-air */
.ihowz-profile-section .form-table tr.has-checkbox-group th {
    line-height: 1.5;
    padding-top: 14px;
    vertical-align: top;
}

/* Checkbox styling in form-table */
.ihowz-profile-section .form-table fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.ihowz-profile-section .form-table fieldset {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ihowz-profile-section .form-table fieldset label {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-size: 16px;
    color: #263238;
    cursor: pointer;
    line-height: 1.5;
    margin: 0;
}

/* "Select All" row at the top of a checkbox group */
.ihowz-profile-section .form-table fieldset label.checkbox-select-all {
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid #e5e5e5;
}

.ihowz-profile-section .form-table fieldset label.checkbox-select-all strong {
    font-weight: 600;
    color: #263238;
}

.ihowz-profile-section .form-table input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    accent-color: #9FC045;
    cursor: pointer;
    flex-shrink: 0;
}

.ihowz-profile-section .form-table input[type="checkbox"]:focus {
    outline: 2px solid #9FC045;
    outline-offset: 2px;
}

/* Submit button styling */
.ihowz-profile-section .submit {
    margin: 32px 0 0 0;
    padding: 0;
}

.ihowz-profile-section .button,
.ihowz-profile-section .button-primary,
.ihowz-profile-section .button-large {
    display: inline-block;
    height: 48px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
}

.ihowz-profile-section .button-primary {
    background-color: #9FC045;
    color: #fff;
}

.ihowz-profile-section .button-primary:hover {
    background-color: #5F8422;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(159, 192, 69, 0.3);
}

.ihowz-profile-section .button-secondary {
    background-color: transparent;
    color: #9FC045;
    border: 2px solid #9FC045;
}

.ihowz-profile-section .button-secondary:hover {
    background-color: #F4F9E8;
}

/* Responsive form-table */
@media (max-width: 768px) {
    .ihowz-profile-section .form-table,
    .ihowz-profile-section .form-table tbody,
    .ihowz-profile-section .form-table tr,
    .ihowz-profile-section .form-table th,
    .ihowz-profile-section .form-table td {
        display: block;
        width: 100%;
    }

    .ihowz-profile-section .form-table th {
        text-align: left;
        padding: 0 0 8px 0;
        line-height: 1.4;
    }

    .ihowz-profile-section .form-table td {
        padding: 0 0 20px 0;
    }

    .ihowz-profile-section .form-table .regular-text,
    .ihowz-profile-section .form-table input[type="text"],
    .ihowz-profile-section .form-table input[type="email"],
    .ihowz-profile-section .form-table input[type="tel"],
    .ihowz-profile-section .form-table input[type="password"],
    .ihowz-profile-section .form-table select {
        max-width: 100%;
    }
}

/* Messages */
.ihowz-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.ihowz-message.success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.ihowz-message.error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.ihowz-message.warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.ihowz-message.info {
    background: #cce5ff;
    border-left: 4px solid #0073aa;
    color: #004085;
}

/* Responsive */
@media (max-width: 768px) {
    .ihowz-portal-nav {
        flex-direction: column;
    }

    .ihowz-nav-item {
        text-align: center;
    }

    .ihowz-dashboard-cards {
        grid-template-columns: 1fr;
    }

    .ihowz-table {
        font-size: 14px;
    }

    .ihowz-table th,
    .ihowz-table td {
        padding: 8px;
    }
}
