/**
 * TCB Accounts — Front-end styles.
 * Uses the same design tokens as the Laytime Calculator and Voyage Estimator.
 */

:root {
    --tcb-bg: #ffffff;
    --tcb-heading-bg: #1a2332;
    --tcb-heading-text: #ffffff;
    --tcb-accent: #c9a84c;
    --tcb-accent-hover: #b8973f;
    --tcb-text: #333333;
    --tcb-text-muted: #666666;
    --tcb-border: #e0e0e0;
    --tcb-error: #dc3545;
    --tcb-success: #28a745;
    --tcb-laytime-badge: #2563eb;
    --tcb-voyage-badge: #059669;
}

/* =========================================================================
   Layout
   ========================================================================= */

.tcb-auth-wrap,
.tcb-account-wrap {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--tcb-text);
}

.tcb-account-wrap {
    max-width: 900px;
}

/* =========================================================================
   Auth card (login, register, lost-password, reset-password)
   ========================================================================= */

.tcb-auth-card {
    background: var(--tcb-bg);
    border: 1px solid var(--tcb-border);
    border-radius: 8px;
    overflow: hidden;
}

.tcb-auth-header {
    background: var(--tcb-heading-bg);
    color: var(--tcb-heading-text);
    padding: 1rem 1.5rem;
}

.tcb-auth-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tcb-heading-text);
}

.tcb-auth-intro {
    padding: 1rem 1.5rem 0;
    margin: 0;
    color: var(--tcb-text-muted);
}

/* =========================================================================
   Forms
   ========================================================================= */

.tcb-form {
    padding: 1.5rem;
}

.tcb-field {
    margin-bottom: 1rem;
}

.tcb-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--tcb-text);
}

.tcb-field input[type="text"],
.tcb-field input[type="email"],
.tcb-field input[type="password"],
.tcb-field input[type="tel"],
.tcb-field input[type="url"],
.tcb-field input[type="number"],
.tcb-field select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--tcb-border);
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.tcb-field input:focus,
.tcb-field select:focus {
    outline: none;
    border-color: var(--tcb-accent);
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15);
}

.tcb-field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--tcb-text-muted);
}

.tcb-field-inline {
    margin-bottom: 1rem;
}

.tcb-field-inline label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
    cursor: pointer;
}

.tcb-field-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}

.tcb-field-row .tcb-field {
    flex: 1;
}

/* Honeypot — visually hidden but in DOM */
.tcb-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.tcb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.tcb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tcb-btn-primary {
    background: var(--tcb-accent);
    color: #ffffff;
}

.tcb-btn-primary:hover:not(:disabled) {
    background: var(--tcb-accent-hover);
}

.tcb-btn-secondary {
    background: var(--tcb-heading-bg);
    color: #ffffff;
}

.tcb-btn-secondary:hover:not(:disabled) {
    background: #243044;
}

.tcb-btn-outline {
    background: transparent;
    color: var(--tcb-text);
    border: 1px solid var(--tcb-border);
}

.tcb-btn-outline:hover {
    background: #f5f5f5;
}

.tcb-btn-small {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--tcb-accent);
    color: #ffffff;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
}

.tcb-btn-small:hover {
    background: var(--tcb-accent-hover);
    color: #ffffff;
}

/* Spinner inside buttons */
.tcb-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: tcb-spin 0.6s linear infinite;
}

@keyframes tcb-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================================
   Notices & messages
   ========================================================================= */

.tcb-notice,
.tcb-form-messages .tcb-msg {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 1rem 1.5rem;
    font-size: 0.9rem;
}

.tcb-form-messages .tcb-msg {
    margin: 0 0 1rem;
}

.tcb-notice-success,
.tcb-msg-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.tcb-notice-error,
.tcb-msg-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* =========================================================================
   Social login divider
   ========================================================================= */

.tcb-social-login {
    padding: 1.5rem 1.5rem 0;
}

.tcb-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 1.5rem 0;
    color: var(--tcb-text-muted);
    font-size: 0.85rem;
}

.tcb-divider::before,
.tcb-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tcb-border);
}

/* =========================================================================
   Auth links
   ========================================================================= */

.tcb-auth-links {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tcb-auth-links a {
    color: var(--tcb-accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.tcb-auth-links a:hover {
    text-decoration: underline;
}

/* =========================================================================
   Account page sections
   ========================================================================= */

.tcb-account-section {
    background: var(--tcb-bg);
    border: 1px solid var(--tcb-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.tcb-section-header {
    background: var(--tcb-heading-bg);
    color: var(--tcb-heading-text);
    padding: 0.85rem 1.5rem;
}

.tcb-section-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--tcb-heading-text);
}

.tcb-profile-readonly {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

.tcb-profile-readonly p {
    margin: 0.25rem 0;
}

.tcb-subsection {
    border-top: 1px solid var(--tcb-border);
    padding: 1.5rem;
}

.tcb-subsection h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--tcb-text);
}

/* =========================================================================
   Calculations toolbar
   ========================================================================= */

.tcb-calc-toolbar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--tcb-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.tcb-calc-counts {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tcb-count-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

.tcb-count-laytime {
    background: rgba(37, 99, 235, 0.1);
    color: var(--tcb-laytime-badge);
}

.tcb-count-voyage {
    background: rgba(5, 150, 105, 0.1);
    color: var(--tcb-voyage-badge);
}

.tcb-count-separator {
    color: var(--tcb-text-muted);
}

.tcb-calc-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.tcb-calc-search {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--tcb-border);
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 180px;
}

.tcb-calc-search:focus {
    outline: none;
    border-color: var(--tcb-accent);
}

.tcb-calc-select {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--tcb-border);
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--tcb-bg);
    cursor: pointer;
}

/* =========================================================================
   Calculations list
   ========================================================================= */

.tcb-calc-list {
    padding: 0;
}

.tcb-vessel-group {
    border-bottom: 1px solid var(--tcb-border);
}

.tcb-vessel-group:last-child {
    border-bottom: none;
}

.tcb-vessel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    cursor: default;
}

.tcb-vessel-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.tcb-vessel-count {
    font-size: 0.8rem;
    color: var(--tcb-text-muted);
}

.tcb-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.5rem 0.65rem 2.5rem;
    border-top: 1px solid #f0f0f0;
    gap: 1rem;
    flex-wrap: wrap;
}

.tcb-calc-row-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.tcb-calc-row-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Badges */
.tcb-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.tcb-badge-laytime {
    background: var(--tcb-laytime-badge);
    color: #ffffff;
}

.tcb-badge-voyage {
    background: var(--tcb-voyage-badge);
    color: #ffffff;
}

.tcb-calc-title {
    font-weight: 500;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.tcb-calc-subtitle {
    font-size: 0.8rem;
    color: var(--tcb-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tcb-calc-result {
    font-size: 0.8rem;
    color: var(--tcb-text-muted);
    white-space: nowrap;
}

.tcb-calc-updated {
    font-size: 0.75rem;
    color: var(--tcb-text-muted);
    white-space: nowrap;
}

/* =========================================================================
   Empty state
   ========================================================================= */

.tcb-empty-state {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--tcb-text-muted);
}

.tcb-empty-state a {
    color: var(--tcb-accent);
    text-decoration: none;
}

.tcb-empty-state a:hover {
    text-decoration: underline;
}

/* =========================================================================
   Logout section
   ========================================================================= */

.tcb-account-logout {
    text-align: center;
    padding: 1.5rem;
}

/* =========================================================================
   Flat view (when sorting by most recent, no grouping)
   ========================================================================= */

.tcb-calc-list.tcb-flat-view .tcb-vessel-group {
    border-bottom: none;
}

.tcb-calc-list.tcb-flat-view .tcb-vessel-header {
    display: none;
}

.tcb-calc-list.tcb-flat-view .tcb-calc-row {
    padding-left: 1.5rem;
    border-top: 1px solid #f0f0f0;
}

.tcb-calc-list.tcb-flat-view .tcb-calc-row:first-child {
    border-top: none;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 640px) {
    .tcb-auth-wrap,
    .tcb-account-wrap {
        margin: 1rem auto;
    }

    .tcb-field-row {
        flex-direction: column;
        gap: 0;
    }

    .tcb-calc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .tcb-calc-controls {
        margin-left: 0;
        flex-direction: column;
    }

    .tcb-calc-row {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 1.5rem;
        gap: 0.5rem;
    }

    .tcb-calc-row-meta {
        flex-wrap: wrap;
    }

    .tcb-calc-title {
        max-width: 100%;
    }
}
