/* ============================================
   Age Calculator - TryToolz
   Scoped inside .trytoolz-calculator-wrapper
   ============================================ */

/* ---- Reset & Base ---- */
.trytoolz-calculator-wrapper *,
.trytoolz-calculator-wrapper *::before,
.trytoolz-calculator-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.trytoolz-calculator-wrapper {
    display: block;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Card ---- */
.trytoolz-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ---- Header ---- */
.trytoolz-header {
    text-align: center;
    margin-bottom: 28px;
}

.trytoolz-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(145deg, #4f46e5, #7c3aed);
    color: #ffffff;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25);
}

.trytoolz-icon {
    width: 30px;
    height: 30px;
    stroke-width: 2;
}

.trytoolz-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    letter-spacing: -0.3px;
}

.trytoolz-subtitle {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
    font-weight: 400;
}

/* ---- Input Section ---- */
.trytoolz-input-section {
    margin-bottom: 8px;
}

.trytoolz-input-group {
    margin-bottom: 18px;
}

.trytoolz-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.trytoolz-input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    color: #1a1a2e;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.trytoolz-input:focus {
    outline: none;
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.trytoolz-input:hover {
    background: #ffffff;
    border-color: #d1d5db;
}

.trytoolz-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.trytoolz-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.trytoolz-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.trytoolz-hint {
    display: block;
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
    font-weight: 400;
}

/* ---- Action Row ---- */
.trytoolz-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

/* ---- Buttons ---- */
.trytoolz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 48px;
}

.trytoolz-btn:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

.trytoolz-btn-primary {
    background: linear-gradient(145deg, #4f46e5, #7c3aed);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.30);
    flex: 1 1 auto;
    min-width: 140px;
}

.trytoolz-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(79, 70, 229, 0.40);
}

.trytoolz-btn-primary:active {
    transform: translateY(0px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.trytoolz-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex: 0 1 auto;
}

.trytoolz-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.trytoolz-btn-secondary:active {
    transform: translateY(0px);
}

.trytoolz-btn-outline {
    background: transparent;
    color: #4f46e5;
    border: 2px solid #e5e7eb;
    flex: 1 1 auto;
    min-width: 120px;
}

.trytoolz-btn-outline:hover {
    background: #f9fafb;
    border-color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.trytoolz-btn-outline:active {
    transform: translateY(0px);
}

.trytoolz-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---- Error ---- */
.trytoolz-error {
    min-height: 28px;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.trytoolz-error:not(:empty) {
    opacity: 1;
}

.trytoolz-error::before {
    content: "⚠️";
    font-size: 16px;
}

/* ---- Results Section ---- */
.trytoolz-results-section {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 2px solid #f3f4f6;
    animation: trytoolzFadeIn 0.5s ease forwards;
}

@keyframes trytoolzFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Age Display ---- */
.trytoolz-age-display {
    text-align: center;
    padding: 16px 0 20px 0;
    background: linear-gradient(145deg, #f9fafb, #f3f4f6);
    border-radius: 16px;
    margin-bottom: 24px;
}

.trytoolz-age-number {
    font-size: 56px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.1;
    letter-spacing: -1.5px;
    font-variant-numeric: tabular-nums;
}

.trytoolz-age-label {
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    margin-top: 2px;
}

/* ---- Breakdown Grid ---- */
.trytoolz-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.trytoolz-breakdown-item {
    text-align: center;
    background: #f9fafb;
    padding: 14px 8px;
    border-radius: 12px;
    transition: background 0.25s ease;
}

.trytoolz-breakdown-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    font-variant-numeric: tabular-nums;
}

.trytoolz-breakdown-label {
    display: block;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ---- Stats Grid ---- */
.trytoolz-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.trytoolz-stat-item {
    background: #f9fafb;
    padding: 14px 12px;
    border-radius: 12px;
    text-align: center;
    transition: background 0.25s ease;
}

.trytoolz-stat-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.trytoolz-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

/* ---- Extra Grid ---- */
.trytoolz-extra-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.trytoolz-extra-item {
    background: #f9fafb;
    padding: 14px 12px;
    border-radius: 12px;
    text-align: center;
    transition: background 0.25s ease;
}

.trytoolz-extra-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.trytoolz-extra-value {
    display: block;
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
    margin-top: 2px;
}

/* ---- Copy Row ---- */
.trytoolz-copy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.trytoolz-copy-feedback {
    font-size: 14px;
    font-weight: 500;
    color: #16a34a;
    min-height: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.trytoolz-copy-feedback.show {
    opacity: 1;
}

/* ---- Notes ---- */
.trytoolz-notes {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f3f4f6;
}

.trytoolz-notes-text {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}

/* ============================================
   DARK MODE
   ============================================ */
@media (prefers-color-scheme: dark) {
    .trytoolz-calculator-wrapper {
        color: #e5e7eb;
    }

    .trytoolz-card {
        background: #1f2937;
        border-color: rgba(255, 255, 255, 0.06);
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
    }

    .trytoolz-title {
        color: #f9fafb;
    }

    .trytoolz-subtitle {
        color: #9ca3af;
    }

    .trytoolz-label {
        color: #d1d5db;
    }

    .trytoolz-input {
        background: #111827;
        color: #f9fafb;
        border-color: #374151;
    }

    .trytoolz-input:focus {
        border-color: #818cf8;
        background: #111827;
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.25);
    }

    .trytoolz-input:hover {
        background: #111827;
        border-color: #4b5563;
    }

    .trytoolz-hint {
        color: #6b7280;
    }

    .trytoolz-btn-secondary {
        background: #374151;
        color: #e5e7eb;
    }

    .trytoolz-btn-secondary:hover {
        background: #4b5563;
    }

    .trytoolz-btn-outline {
        color: #818cf8;
        border-color: #374151;
    }

    .trytoolz-btn-outline:hover {
        background: #1f2937;
        border-color: #818cf8;
    }

    .trytoolz-age-display {
        background: linear-gradient(145deg, #111827, #1f2937);
    }

    .trytoolz-age-number {
        color: #f9fafb;
    }

    .trytoolz-age-label {
        color: #9ca3af;
    }

    .trytoolz-breakdown-item,
    .trytoolz-stat-item,
    .trytoolz-extra-item {
        background: #111827;
    }

    .trytoolz-breakdown-value,
    .trytoolz-stat-value,
    .trytoolz-extra-value {
        color: #f9fafb;
    }

    .trytoolz-breakdown-label,
    .trytoolz-stat-label,
    .trytoolz-extra-label {
        color: #9ca3af;
    }

    .trytoolz-notes {
        border-top-color: #374151;
    }

    .trytoolz-notes-text {
        color: #9ca3af;
    }

    .trytoolz-error {
        color: #f87171;
    }

    .trytoolz-copy-feedback {
        color: #4ade80;
    }

    .trytoolz-results-section {
        border-top-color: #374151;
    }

    .trytoolz-icon-wrapper {
        background: linear-gradient(145deg, #6366f1, #8b5cf6);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .trytoolz-calculator-wrapper {
        padding: 8px;
    }

    .trytoolz-card {
        padding: 20px 16px;
        border-radius: 18px;
    }

    .trytoolz-title {
        font-size: 22px;
    }

    .trytoolz-subtitle {
        font-size: 14px;
    }

    .trytoolz-age-number {
        font-size: 40px;
    }

    .trytoolz-breakdown-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .trytoolz-breakdown-value {
        font-size: 22px;
    }

    .trytoolz-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .trytoolz-extra-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .trytoolz-stat-value {
        font-size: 17px;
    }

    .trytoolz-extra-value {
        font-size: 15px;
    }

    .trytoolz-action-row {
        flex-direction: column;
    }

    .trytoolz-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        padding: 10px 20px;
        font-size: 14px;
    }

    .trytoolz-btn-primary {
        min-width: unset;
    }

    .trytoolz-btn-outline {
        min-width: unset;
    }

    .trytoolz-input {
        font-size: 15px;
        padding: 10px 14px;
    }

    .trytoolz-icon-wrapper {
        width: 48px;
        height: 48px;
    }

    .trytoolz-icon {
        width: 26px;
        height: 26px;
    }

    .trytoolz-copy-row {
        flex-direction: column;
    }

    .trytoolz-copy-feedback {
        text-align: center;
    }
}

@media (max-width: 420px) {
    .trytoolz-card {
        padding: 16px 12px;
    }

    .trytoolz-title {
        font-size: 19px;
    }

    .trytoolz-age-number {
        font-size: 34px;
    }

    .trytoolz-breakdown-value {
        font-size: 18px;
    }

    .trytoolz-breakdown-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .trytoolz-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .trytoolz-extra-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .trytoolz-stat-value {
        font-size: 15px;
    }

    .trytoolz-extra-value {
        font-size: 14px;
    }

    .trytoolz-btn {
        font-size: 13px;
        padding: 8px 16px;
        min-height: 40px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .trytoolz-card {
        padding: 28px 24px;
    }

    .trytoolz-age-number {
        font-size: 48px;
    }
}

/* ---- Print Friendly ---- */
@media print {
    .trytoolz-calculator-wrapper {
        padding: 0;
    }
    .trytoolz-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    .trytoolz-btn {
        display: none;
    }
    .trytoolz-input {
        border: 1px solid #aaa;
    }
}