/* ==========================
   TM Auth - Frontend CSS
   ========================== */

:root {
    --tm-primary: #1a73e8;
    --tm-primary-dark: #1558b0;
    --tm-green: #0f9d58;
    --tm-red: #d93025;
    --tm-amber: #f9ab00;
    --tm-text: #202124;
    --tm-muted: #70757a;
    --tm-border: #e0e0e0;
    --tm-bg-light: #f8f9fa;
    --tm-radius: 12px;
    --tm-shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
    --tm-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
    --tm-transition: all 0.2s ease;
}

/* ===== PAGE HEADER ===== */
.tm-page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--tm-text);
    margin: 0 0 4px;
}

.tm-page-subtitle {
    color: var(--tm-muted);
    margin: 0 0 24px;
    font-size: 14px;
}

.tm-muted {
    color: var(--tm-muted);
    font-size: 13px;
}

/* ===== BUTTONS ===== */
.tm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    border: 2px solid transparent;
    transition: var(--tm-transition);
    line-height: 1.4;
}

.tm-btn-primary {
    background: var(--tm-primary);
    color: #fff;
    border-color: var(--tm-primary);
}

.tm-btn-primary:hover {
    background: var(--tm-primary-dark);
    border-color: var(--tm-primary-dark);
    color: #fff;
}

.tm-btn-secondary {
    background: #fff;
    color: var(--tm-primary);
    border-color: var(--tm-primary);
}

.tm-btn-secondary:hover {
    background: #e8f0fe;
}

.tm-btn-ghost {
    background: transparent;
    color: var(--tm-muted);
    border-color: var(--tm-border);
}

.tm-btn-ghost:hover {
    background: var(--tm-bg-light);
    color: var(--tm-text);
}

.tm-btn-download {
    background: var(--tm-green);
    color: #fff;
    border-color: var(--tm-green);
    font-size: 13px;
    padding: 8px 16px;
}

.tm-btn-download:hover {
    background: #0b7042;
    color: #fff;
}

.tm-btn-large {
    padding: 12px 28px;
    font-size: 16px;
}

/* ===== HEADER ROW ===== */
.tm-my-certs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ===== EMPTY STATE ===== */
.tm-empty-certs {
    text-align: center;
    padding: 60px 20px;
    background: var(--tm-bg-light);
    border: 2px dashed var(--tm-border);
    border-radius: var(--tm-radius);
}

.tm-empty-icon-wrap {
    margin-bottom: 16px;
}

.tm-empty-certs p {
    color: var(--tm-muted);
    margin-bottom: 20px;
}

/* ===== CERTS GRID ===== */
.tm-certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tm-cert-card {
    background: #fff;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: 20px;
    box-shadow: var(--tm-shadow-sm);
    transition: var(--tm-transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 4px solid #ccc;
}

.tm-cert-card:hover {
    box-shadow: var(--tm-shadow);
    transform: translateY(-1px);
}

.tm-cert-pending {
    border-top-color: var(--tm-amber);
}

.tm-cert-approved {
    border-top-color: var(--tm-green);
}

.tm-cert-rejected {
    border-top-color: var(--tm-red);
}

/* Brand row */
.tm-cert-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tm-cert-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--tm-primary), #5b9eeb);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tm-cert-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--tm-text);
}

.tm-cert-docno {
    font-size: 12px;
    color: var(--tm-muted);
    font-family: monospace;
}

/* Status row */
.tm-cert-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tm-cert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tm-cert-badge-pending {
    background: #fff8e1;
    color: #856404;
}

.tm-cert-badge-approved {
    background: #e6f4ea;
    color: #137333;
}

.tm-cert-badge-rejected {
    background: #fce8e6;
    color: #c5221f;
}

.tm-cert-date {
    font-size: 12px;
    color: var(--tm-muted);
}

/* Meta & rejection */
.tm-cert-meta {
    font-size: 13px;
    color: #555;
}

.tm-cert-rejection {
    font-size: 12px;
    color: var(--tm-red);
    background: #fce8e6;
    border-radius: 6px;
    padding: 8px 10px;
}

.tm-cert-actions {
    margin-top: auto;
}

.tm-cert-pending-msg {
    font-size: 13px;
    color: var(--tm-muted);
    font-style: italic;
}

/* ===== REQUEST FORM ===== */
.tm-request-header {
    margin-bottom: 24px;
}

.tm-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tm-primary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 12px;
}

.tm-back-link:hover {
    text-decoration: underline;
}

.tm-form-section {
    background: #fff;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: 24px;
    margin-bottom: 20px;
}

.tm-section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 18px;
    color: var(--tm-text);
}

/* Brand selection grid */
.tm-brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.tm-brand-option {
    cursor: pointer;
}

.tm-brand-option input[type="radio"] {
    display: none;
}

.tm-brand-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--tm-border);
    border-radius: 10px;
    transition: var(--tm-transition);
    position: relative;
}

.tm-brand-option input:checked+.tm-brand-card {
    border-color: var(--tm-primary);
    background: #e8f0fe;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.tm-brand-card:hover {
    border-color: #adc6f5;
    background: #f4f8ff;
}

.tm-brand-initial {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--tm-primary), #5b9eeb);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tm-brand-info {
    flex: 1;
}

.tm-brand-info strong {
    display: block;
    font-size: 14px;
}

.tm-brand-info small {
    color: var(--tm-muted);
    font-size: 12px;
}

.tm-brand-check {
    color: var(--tm-primary);
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.15s;
}

.tm-brand-option input:checked+.tm-brand-card .tm-brand-check {
    opacity: 1;
}

.tm-brand-disabled {
    cursor: default;
    opacity: 0.6;
}

.tm-brand-disabled .tm-brand-card {
    background: var(--tm-bg-light);
    cursor: default;
}

.tm-brand-disabled .tm-brand-card:hover {
    border-color: var(--tm-border);
    background: var(--tm-bg-light);
}

.tm-brand-check-done {
    opacity: 1;
    color: var(--tm-green);
}

/* Form fields */
.tm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .tm-form-row {
        grid-template-columns: 1fr;
    }
}

.tm-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.tm-form-field input,
.tm-form-field textarea {
    width: 100%;
    border: 1.5px solid var(--tm-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--tm-text);
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.tm-form-field input:focus,
.tm-form-field textarea:focus {
    border-color: var(--tm-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.tm-form-field-full {
    grid-column: 1 / -1;
}

.tm-optional {
    font-weight: normal;
    color: var(--tm-muted);
}

/* Submit section */
.tm-form-submit {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tm-submit-note {
    flex: 1;
    font-size: 13px;
    color: var(--tm-muted);
    margin: 0;
    min-width: 200px;
}

/* Alerts */
.tm-alert {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.tm-alert-info {
    background: #e8f0fe;
    color: #174ea6;
    border: 1px solid #adc6f5;
}