/**
 * Secesta Appointment System — Frontend Popup Styles
 * Modern, mobile-first calendar design
 */

/* === Google Font === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* === Trigger Buttons === */
.ag-appointment-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    text-decoration: none;
    transition: all .3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    line-height: 1.4;
}

.ag-appointment-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.ag-btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.ag-btn-medium {
    padding: 12px 24px;
    font-size: 15px;
}

.ag-btn-large {
    padding: 16px 32px;
    font-size: 17px;
}

/* === Floating Button === */
.ag-floating-btn {
    position: fixed;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 50px;
    padding: 14px 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
    transition: all .3s ease;
}

.ag-floating-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(0, 0, 0, .25);
}

.ag-floating-bottom-right {
    bottom: 24px;
    right: 24px;
}

.ag-floating-bottom-left {
    bottom: 24px;
    left: 24px;
}

.ag-floating-top-right {
    top: 24px;
    right: 24px;
}

.ag-floating-top-left {
    top: 24px;
    left: 24px;
}

@media (max-width: 600px) {
    .ag-floating-btn span {
        display: none;
    }

    .ag-floating-btn {
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }
}

/* === Popup Overlay === */
.ag-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: agFadeIn .3s ease;
}

@keyframes agFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* === Popup Container === */
.ag-popup-container {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 28px 24px 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .1);
    animation: agSlideUp .4s cubic-bezier(.16, 1, .3, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@keyframes agSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ag-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #bbb;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all .2s;
}

.ag-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* === Popup Header === */
.ag-popup-header {
    text-align: center;
    margin-bottom: 16px;
}

.ag-popup-header h2 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -.3px;
}

.ag-popup-header p {
    color: #888;
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}

/* === Progress Bar === */
.ag-progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 22px;
    padding: 0 10px;
}

.ag-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ag-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e9ecef;
    color: #adb5bd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    transition: all .3s;
}

.ag-step-label {
    font-size: 10px;
    color: #adb5bd;
    font-weight: 600;
    transition: all .3s;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.ag-progress-step.active .ag-step-num {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    box-shadow: 0 3px 12px rgba(46, 204, 113, .4);
}

.ag-progress-step.active .ag-step-label {
    color: #27ae60;
}

.ag-progress-step.done .ag-step-num {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 176, 155, .3);
}

.ag-progress-step.done .ag-step-label {
    color: #00b09b;
}

.ag-progress-line {
    flex: 1;
    height: 2px;
    background: #e9ecef;
    margin: 0 6px;
    margin-bottom: 18px;
    transition: background .3s;
    border-radius: 2px;
}

.ag-progress-line.done {
    background: linear-gradient(90deg, #00b09b, #96c93d);
}

/* === Calendar === */
.ag-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}

.ag-cal-prev,
.ag-cal-next {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    color: #495057;
}

.ag-cal-prev:hover,
.ag-cal-next:hover {
    background: #2ecc71;
    border-color: #2ecc71;
    color: #fff;
    box-shadow: 0 2px 8px rgba(46, 204, 113, .3);
}

.ag-cal-month {
    font-weight: 700;
    font-size: 15px;
    color: #1a1a2e;
    letter-spacing: -.2px;
}

/* === Calendar Grid === */
.ag-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.ag-cal-day-header {
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    color: #adb5bd;
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* === Calendar Day Cell === */
.ag-cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s ease;
    min-height: 44px;
    position: relative;
    border: 2px solid transparent;
    gap: 1px;
}

.ag-cal-num {
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #333;
}

/* === Available Day (hover) === */
.ag-cal-day:not(.ag-cal-disabled):not(.ag-cal-empty):not(.ag-cal-past):hover {
    background: rgba(46, 204, 113, .08);
    border-color: rgba(46, 204, 113, .3);
    transform: scale(1.05);
}

/* === Selected Day === */
.ag-cal-day.ag-cal-selected {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(46, 204, 113, .35);
    transform: scale(1.05);
}

.ag-cal-day.ag-cal-selected .ag-cal-num {
    color: #fff;
}

/* === Today === */
.ag-cal-day.ag-cal-today {
    border-color: #2ecc71;
}

.ag-cal-day.ag-cal-today .ag-cal-num {
    color: #2ecc71;
    font-weight: 800;
}

.ag-cal-day.ag-cal-today.ag-cal-selected .ag-cal-num {
    color: #fff;
}

/* === Disabled Day (no slots = "dolu") === */
.ag-cal-day.ag-cal-disabled {
    cursor: default;
    opacity: 1;
}

.ag-cal-day.ag-cal-disabled .ag-cal-num {
    color: #ccc;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    text-decoration-color: #d4d4d4;
}

.ag-cal-label-full {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #e74c3c;
    line-height: 1;
    opacity: .85;
}

/* === Past Day === */
.ag-cal-day.ag-cal-past {
    cursor: default;
    opacity: .35;
}

.ag-cal-day.ag-cal-past .ag-cal-num {
    color: #ccc;
    text-decoration: none;
}

/* === Empty Cell === */
.ag-cal-day.ag-cal-empty {
    visibility: hidden;
}

/* === Calendar Loading === */
.ag-calendar-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 36px;
    color: #adb5bd;
    font-size: 14px;
}

/* === Time Grid === */
.ag-step-title {
    text-align: center;
    font-size: 15px;
    color: #495057;
    margin-bottom: 18px;
    font-weight: 500;
}

.ag-time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ag-time-slot {
    padding: 12px 8px;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all .2s;
}

.ag-time-slot:hover:not(.ag-time-disabled) {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, .06);
    transform: scale(1.02);
}

.ag-time-slot.ag-time-selected {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(46, 204, 113, .3);
}

.ag-time-slot.ag-time-disabled {
    background: #fafafa;
    color: #ccc;
    cursor: default;
    text-decoration: line-through;
    border-color: #f0f0f0;
}

.ag-no-times {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
    color: #adb5bd;
    font-style: italic;
    font-size: 14px;
}

/* === Form === */
.ag-form-group {
    margin-bottom: 14px;
}

.ag-form-group label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* Input wrapper with icon */
.ag-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.ag-input-icon {
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    pointer-events: none;
    z-index: 1;
    transition: color .2s;
}

.ag-input-icon-textarea {
    top: 14px;
    transform: none;
}

.ag-input-wrap input,
.ag-input-wrap textarea,
.ag-input-wrap select {
    width: 100%;
    padding: 11px 14px 11px 36px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all .2s;
    box-sizing: border-box;
    outline: none;
    color: #333;
    background: #fafbfc;
}

.ag-input-wrap input:focus,
.ag-input-wrap textarea:focus {
    border-color: #2ecc71;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, .1);
    background: #fff;
}

.ag-input-wrap input:focus+.ag-input-icon,
.ag-input-wrap:focus-within .ag-input-icon {
    color: #2ecc71;
}

.ag-input-wrap input.ag-field-invalid,
.ag-input-wrap textarea.ag-field-invalid {
    border-color: #e74c3c;
}

.ag-input-wrap input.ag-field-invalid+.ag-input-icon,
.ag-input-wrap:has(.ag-field-invalid) .ag-input-icon {
    color: #e74c3c;
}

.ag-input-wrap-textarea {
    align-items: flex-start;
}

.ag-input-wrap textarea {
    resize: vertical;
    min-height: 52px;
}

.ag-field-error {
    display: block;
    color: #e74c3c;
    font-size: 11px;
    margin-top: 2px;
    min-height: 14px;
    font-weight: 500;
    padding-left: 2px;
}

/* === Navigation Buttons === */
.ag-popup-nav {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}

.ag-btn {
    padding: 11px 26px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.ag-btn-primary {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    box-shadow: 0 3px 12px rgba(46, 204, 113, .3);
}

.ag-btn-primary:hover:not(:disabled) {
    box-shadow: 0 5px 20px rgba(46, 204, 113, .4);
    transform: translateY(-1px);
}

.ag-btn-primary:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ag-btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #e9ecef;
}

.ag-btn-secondary:hover {
    background: #e9ecef;
}

/* === Success Screen === */
.ag-success-screen {
    text-align: center;
    padding: 16px 0;
}

.ag-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
}

.ag-success-icon svg {
    width: 72px;
    height: 72px;
}

.ag-checkmark-circle {
    stroke: #00b09b;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: agStroke .6s cubic-bezier(.65, 0, .45, 1) forwards;
}

.ag-checkmark-check {
    stroke: #00b09b;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: agStroke .3s cubic-bezier(.65, 0, .45, 1) .4s forwards;
}

@keyframes agStroke {
    100% {
        stroke-dashoffset: 0;
    }
}

.ag-success-screen h3 {
    font-size: 18px;
    color: #00b09b;
    margin-bottom: 14px;
    font-weight: 700;
}

.ag-success-details {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13px;
    color: #333;
    text-align: left;
    border: 1px solid #d1fae5;
}

.ag-success-details p {
    margin: 5px 0;
}

.ag-success-details strong {
    color: #1a1a2e;
}

/* === Loading & Messages === */
.ag-popup-loading {
    text-align: center;
    padding: 20px;
}

.ag-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #2ecc71;
    border-radius: 50%;
    animation: agSpin .8s linear infinite;
    margin: 0 auto;
}

@keyframes agSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.ag-popup-message {
    padding: 10px 14px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
}

.ag-popup-message.ag-msg-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.ag-popup-message.ag-msg-info {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

/* ========================================= */
/* === MOBILE RESPONSIVE                 === */
/* ========================================= */
@media (max-width: 480px) {
    .ag-popup-container {
        padding: 20px 16px 18px;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
        margin-top: auto;
        max-width: 100%;
    }

    .ag-popup-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .ag-popup-header h2 {
        font-size: 18px;
    }

    .ag-popup-header p {
        font-size: 12px;
    }

    .ag-progress-bar {
        padding: 0;
        margin-bottom: 16px;
    }

    .ag-step-label {
        font-size: 9px;
    }

    .ag-step-num {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .ag-calendar-grid {
        gap: 2px;
    }

    .ag-cal-day {
        padding: 4px 1px;
        min-height: 40px;
        border-radius: 8px;
        border-width: 1.5px;
    }

    .ag-cal-num {
        font-size: 13px;
    }

    .ag-cal-label-full {
        font-size: 7px;
    }

    .ag-cal-day-header {
        font-size: 10px;
        padding: 4px 0;
    }

    .ag-cal-prev,
    .ag-cal-next {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .ag-cal-month {
        font-size: 14px;
    }

    .ag-time-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .ag-time-slot {
        padding: 10px 6px;
        font-size: 13px;
    }

    .ag-form-group input,
    .ag-form-group textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    .ag-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .ag-popup-nav {
        margin-top: 14px;
        padding-top: 12px;
    }
}

@media (max-width: 360px) {
    .ag-cal-day {
        min-height: 36px;
        padding: 3px 0;
    }

    .ag-cal-num {
        font-size: 12px;
    }

    .ag-cal-label-full {
        font-size: 6px;
    }

    .ag-popup-container {
        padding: 16px 12px 14px;
    }

    .ag-time-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}