/* ─────────────────────────────────────────────
 * TASA DayBook Frontend Styles
 * ───────────────────────────────────────────── */

/* Wrapper */
.tdb-frontend-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Fullscreen shell */
body.tdb-fullscreen-page {
    margin: 0;
    min-height: 100vh;
    background: #f4f6fb;
}

.tdb-fullscreen-shell {
    min-height: 100vh;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

body.tdb-fullscreen-page.admin-bar .tdb-fullscreen-shell {
    min-height: calc(100vh - 32px);
}

.tdb-frontend-wrap--fullscreen {
    width: 100%;
    max-width: 860px;
    margin: 0;
    padding: 0;
}

body.tdb-fullscreen-page .tdb-card {
    margin: 0;
}

/* Card */
.tdb-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px;
    margin: 20px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.tdb-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.tdb-card__header-main {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.tdb-card__icon {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #667eea;
    flex-shrink: 0;
}

.tdb-card__title {
    margin: 0 0 4px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.tdb-card__subtitle {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.tdb-card__user {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
}

.tdb-card__user-row {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tdb-card__user-row .tdb-card__user {
    margin: 0;
}

.tdb-card__brand {
    margin-left: auto;
    padding-top: 2px;
}

.tdb-card__brand-logo {
    display: block;
    width: auto;
    max-width: 190px;
    max-height: 64px;
    object-fit: contain;
}

/* Alert */
.tdb-alert {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 15px;
    line-height: 1.6;
}

.tdb-alert .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.tdb-alert strong {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
}

.tdb-alert p {
    margin: 8px 0;
}

.tdb-alert p:last-child {
    margin-bottom: 0;
}

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

.tdb-alert--warning .dashicons {
    color: #ffc107;
}

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

.tdb-alert--error .dashicons {
    color: #dc3545;
}

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

.tdb-alert--success .dashicons {
    color: #28a745;
}

.tdb-alert--submitted {
    align-items: center;
}

.tdb-alert--with-logo {
    align-items: center;
}

.tdb-alert__content {
    min-width: 0;
}

.tdb-alert__logo {
    margin-left: auto;
    width: auto;
    max-width: 140px;
    max-height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Form */
.tdb-form {
    max-width: 100%;
}

.tdb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.tdb-field--full {
    grid-column: 1 / -1;
}

.tdb-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 10px;
}

.tdb-field label .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #667eea;
}

.tdb-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tdb-input-prefix {
    position: absolute;
    left: 16px;
    top: 14px;
    font-weight: 600;
    font-size: 16px;
    color: #666;
    pointer-events: none;
}

.tdb-input {
    width: 100%;
    padding: 12px 16px 12px 30px !important;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

.tdb-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.tdb-input:hover {
    border-color: #b8b8b8;
}

.tdb-input--textarea {
    padding: 12px 14px !important;
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}

/* Preview */
.tdb-preview {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 28px 0;
    text-align: center;
}

.tdb-preview__label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #555;
    margin-bottom: 10px;
}

.tdb-preview__value {
    font-size: 36px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 10px 0;
    transition: color 0.3s ease;
}

.tdb-preview__formula {
    font-size: 13px;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    line-height: 1.5;
}

/* Buttons */
.tdb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

.tdb-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.tdb-btn--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.tdb-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    color: #fff;
}

.tdb-btn--primary:active {
    transform: translateY(0);
}

.tdb-btn--large {
    padding: 16px 32px;
    font-size: 17px;
    width: 100%;
}

.tdb-btn--logout {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #eef2ff;
    color: #374151;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
}

.tdb-btn--logout:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
    transform: none;
    box-shadow: none;
}

/* Recent records table */
.tdb-recent-records__table-wrap {
    width: 100%;
    overflow-x: auto;
}

.tdb-recent-records__table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.tdb-recent-records__table th,
.tdb-recent-records__table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

.tdb-recent-records__table th {
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
}

.tdb-recent-records__table tbody tr:hover {
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
    .tdb-frontend-wrap {
        padding: 10px;
    }

    .tdb-fullscreen-shell {
        align-items: flex-start;
        padding: 14px;
    }

    body.tdb-fullscreen-page.admin-bar .tdb-fullscreen-shell {
        min-height: calc(100vh - 46px);
    }

    .tdb-card {
        padding: 20px;
        border-radius: 8px;
    }

    .tdb-card__header {
        flex-direction: column;
        gap: 12px;
    }

    .tdb-card__header-main {
        width: 100%;
    }

    .tdb-card__brand {
        align-self: flex-end;
        margin-left: 0;
    }

    .tdb-card__brand-logo {
        max-width: 150px;
        max-height: 52px;
    }

    .tdb-card__title {
        font-size: 20px;
    }

    .tdb-card__user-row {
        gap: 8px;
    }

    .tdb-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tdb-preview__value {
        font-size: 28px;
    }

    .tdb-alert {
        flex-direction: column;
        gap: 10px;
    }

    .tdb-alert__logo {
        margin-left: 0;
        max-width: 120px;
        max-height: 42px;
    }

    .tdb-recent-records__table {
        min-width: 0;
    }

    .tdb-recent-records__table thead {
        display: none;
    }

    .tdb-recent-records__table,
    .tdb-recent-records__table tbody,
    .tdb-recent-records__table tr,
    .tdb-recent-records__table td {
        display: block;
        width: 100%;
    }

    .tdb-recent-records__table tr {
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 8px 10px;
        background: #fff;
    }

    .tdb-recent-records__table td {
        border: 0;
        padding: 8px 0;
        white-space: normal;
        text-align: right;
        position: relative;
        padding-left: 48%;
    }

    .tdb-recent-records__table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 8px;
        width: 44%;
        font-weight: 700;
        color: #334155;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .tdb-card {
        padding: 16px;
    }

    .tdb-card__title {
        font-size: 18px;
    }

    .tdb-input {
        font-size: 15px;
    }

    .tdb-btn--large {
        padding: 14px 24px;
        font-size: 16px;
    }
}
