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

:root {
    --primary: #0066ff; /* Calendly Blue */
    --primary-hover: #0052cc;
    --primary-light: rgba(0, 102, 255, 0.08);
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666666;
    --border: #e8e8e8;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --pending: #f59e0b;
    --pending-light: #fef3c7;
    --radius: 12px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
    --font: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Containers */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex-grow: 1;
}

.container-narrow {
    max-width: 600px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Calendly layout card */
.calendly-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    max-width: 950px;
    margin: 2rem auto;
    min-height: 520px;
    overflow: hidden;
    position: relative;
}

@media (max-width: 850px) {
    .calendly-card {
        flex-direction: column;
        min-height: auto;
    }
}

/* Left panel: Info */
.calendly-info {
    width: 320px;
    padding: 2.5rem 2rem;
    border-right: 1px solid var(--border);
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

@media (max-width: 850px) {
    .calendly-info {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 2rem;
    }
}

.company-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.meeting-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.25;
}

.meeting-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.meeting-meta svg {
    color: var(--text-muted);
}

.meeting-desc {
    font-size: 0.875rem;
    color: #555555;
    margin-top: 1rem;
    line-height: 1.6;
}

/* Right panel: Main schedule flow */
.calendly-scheduler {
    flex: 1;
    display: flex;
    background-color: #fff;
    position: relative;
}

@media (max-width: 640px) {
    .calendly-scheduler {
        flex-direction: column;
    }
}

/* Step 1: Selection Area */
.step-container {
    display: flex;
    width: 100%;
    transition: var(--transition);
}

@media (max-width: 640px) {
    .step-container {
        flex-direction: column;
    }
}

/* Interactive Calendar */
.calendar-section {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.calendar-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-control h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.btn-nav-cal {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-muted);
}

.btn-nav-cal:hover:not(:disabled) {
    background-color: var(--bg);
    color: var(--text);
}

.btn-nav-cal:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    text-align: center;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    user-select: none;
    color: var(--primary); /* Calendly style: bookable days are blue */
    background-color: var(--primary-light);
}

.day-cell:hover:not(.disabled):not(.selected) {
    background-color: rgba(0, 102, 255, 0.15);
}

.day-cell.selected {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.day-cell.disabled {
    color: #ccc !important;
    background-color: transparent !important;
    cursor: not-allowed;
    pointer-events: none;
}

.day-cell.empty {
    background-color: transparent !important;
    cursor: default;
    pointer-events: none;
}

/* Time Slots Column (Slides out next to calendar) */
.time-slots-section {
    width: 240px;
    border-left: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: none; /* Shown dynamically */
    flex-direction: column;
}

@media (max-width: 850px) {
    .time-slots-section {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

.time-slots-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.slots-scroll {
    overflow-y: auto;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.25rem;
}

.slots-scroll::-webkit-scrollbar {
    width: 4px;
}

.slots-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Time button click flow like Calendly */
.slot-btn-container {
    display: flex;
    gap: 0.25rem;
    width: 100%;
    transition: var(--transition);
}

.slot-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(0, 102, 255, 0.3);
    background-color: #fff;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.slot-btn:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.slot-confirm-btn {
    display: none;
    padding: 0.75rem;
    background-color: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    animation: fadeIn 0.2s ease-in-out;
    width: 45%;
}

.slot-confirm-btn:hover {
    background-color: var(--primary-hover);
}

/* State when time is selected */
.slot-btn-container.selected .slot-btn {
    background-color: #666;
    color: #fff;
    border-color: #666;
    flex: 0.55;
}

.slot-btn-container.selected .slot-confirm-btn {
    display: block;
}

/* Step 2: Form Details */
.form-section {
    display: none; /* Shown dynamically */
    width: 100%;
    padding: 2.5rem;
    animation: slideIn 0.3s ease-out;
}

.btn-back {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.btn-back:hover {
    color: var(--primary-hover);
}

/* Inputs and Forms default styling (retained) */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: var(--font);
    border-radius: var(--radius-sm);
    border: 1px solid #d1d1d1;
    background-color: #ffffff;
    color: var(--text);
    transition: var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23666666' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 9999px; /* Rounded pill like Calendly */
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: var(--font);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-outline {
    background-color: transparent;
    border-color: #d1d1d1;
    color: var(--text);
}

.btn-outline:hover {
    background-color: var(--bg);
    border-color: var(--text-muted);
}

.btn-success {
    background-color: var(--success-light);
    color: #065f46;
}

.btn-success:hover {
    background-color: var(--success);
    color: #ffffff;
}

.btn-danger {
    background-color: var(--error-light);
    color: #991b1b;
}

.btn-danger:hover {
    background-color: var(--error);
    color: #ffffff;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-pendiente {
    background-color: var(--pending-light);
    color: #92400e;
}

.badge-confirmado {
    background-color: var(--success-light);
    color: #065f46;
}

.badge-cancelado {
    background-color: var(--error-light);
    color: #991b1b;
}

/* Notifications */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: var(--success-light);
    border-color: rgba(16, 185, 129, 0.2);
    color: #065f46;
}

.alert-error {
    background-color: var(--error-light);
    border-color: rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

/* Admin Dashboard Structure */
.admin-navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-logo span {
    color: var(--text);
}

.admin-logout {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
}

.admin-logout:hover {
    color: var(--error);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

/* Dashboard Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Booking Table / List */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: #fcfcfc;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fafafa;
}

/* Actions cell */
.actions-cell {
    display: flex;
    gap: 0.375rem;
}

/* Table empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    color: #ddd;
}

/* Detail Info formatting */
.client-info div {
    display: flex;
    flex-direction: column;
}

.client-name {
    font-weight: 600;
    color: var(--text);
}

.client-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Time formatting */
.date-info {
    font-weight: 500;
}

.time-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Login Card styling */
.login-card {
    max-width: 400px;
    margin: 5rem auto;
}

/* Question tooltip/collapse */
.question-text {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.question-text:hover {
    white-space: normal;
    overflow: visible;
    background-color: var(--bg);
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    position: absolute;
    z-index: 10;
    max-width: 300px;
    box-shadow: var(--shadow-lg);
}

/* Footer styling */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background-color: var(--card-bg);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}
