/* Components - buttons, status bar, overlays, cards, panels */

/* Route Buttons */
.route-btn {
    padding: 1rem;
    background: var(--bg);
    border: 2px solid var(--primary);
    border-radius: 12px;
    color: var(--primary);
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.route-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.route-btn span {
    position: relative;
    z-index: 1;
}

.route-btn:hover::before,
.route-btn.active::before {
    transform: translateY(0);
}

.route-btn:hover,
.route-btn.active {
    color: white;
}

.route-select {
    width: 100%;
    min-height: 46px;
    padding: 0.9rem 1.1rem;
    border: 2px solid var(--primary);
    border-radius: 16px;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--primary);
    background: #fff;
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="%23000000" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path></svg>');
    background-position: calc(100% - 0.8rem) 50%;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    padding-right: 2.4rem;
}

.route-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26, 58, 74, 0.12);
}

/* Poem Card - Full Screen Overlay */
.poem-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 58, 74, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    overflow-y: auto;
}

.poem-overlay.active {
    display: block;
}

.poem-card {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
}

.poem-card-inner {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.poem-number {
    position: absolute;
    top: -15px;
    right: 2rem;
    background: var(--accent);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Crimson Pro', serif;
    font-size: 1.5rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(196, 154, 108, 0.4);
}

.poem-arrived {
    text-align: center;
    color: var(--success);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.poem-distance {
    text-align: center;
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.poem-title {
    font-family: 'Crimson Pro', serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.poem-author {
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.poem-location {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.poem-location svg,
.poem-distance svg,
.poem-list-distance svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
    display: block;
}

.poem-content {
    font-size: 0.95rem;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 1.2rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(
        to bottom,
        rgba(196, 154, 108, 0.05),
        transparent
    );
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.poem-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.poem-actions .btn {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    padding: 0.85rem 1rem;
}

/* Generic Button Styles */
.btn {
    flex: 1;
    min-width: 140px;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 16px;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.1;
    vertical-align: middle;
}

.btn-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
    display: block;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 74, 0.3);
}

.btn-secondary {
    background: var(--accent);
    color: white;
}

.btn-secondary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 154, 108, 0.3);
}

.btn-close {
    background: transparent;
    border: 2px solid var(--text-light);
    color: var(--text-light);
}

.btn-close:hover {
    border-color: var(--text);
    color: var(--text);
}

/* Poems List Panel */
.poems-list-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1500;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 20px 20px 0 0;
}

.poems-list-panel.active {
    transform: translateY(0);
}

.poems-list-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--bg);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poems-list-header h3 {
    font-family: 'Crimson Pro', serif;
    color: var(--primary);
    font-size: 1.3rem;
}

.close-list-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.5rem;
}

.poem-list-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bg);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 1rem;
    align-items: start;
}

.poem-list-item:hover {
    background: var(--bg);
}

.poem-list-item.visited {
    background: rgba(74, 124, 89, 0.05);
}

.poem-list-number {
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    flex-shrink: 0;
}

.poem-list-number.visited {
    background: var(--success);
}

.poem-list-info {
    flex: 1;
}

.poem-list-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.poem-list-author {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

.poem-list-distance {
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.toggle-list-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1400;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 58, 74, 0.3);
    transition: all 0.3s;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    line-height: 1;
}

.toggle-list-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
    display: block;
}

.toggle-list-btn span {
    line-height: 1;
}

.recenter-btn {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1400;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 16px rgba(26, 58, 74, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.recenter-btn.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.recenter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 74, 0.3);
}

.recenter-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    display: block;
}

.toggle-list-btn.active {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-list-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 74, 0.4);
}

/* Loading State */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: white;
    padding: 10px;
}

.loading-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.loading-brand .brand-logo {
    width: 60px;
    height: 60px;
}

.loading-brand-text {
    text-align: left;
    line-height: 1em;
}

.loading-brand-text h2 {
    margin: 0;
    line-height: 1em;
}

.loading-brand-text p {
    margin: 0;
    line-height: 1em;
    opacity: 0.9;
}

.loading-content h2 {
    font-family: 'Crimson Pro', serif;
    font-size: 2rem;
    margin-bottom: 0;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: 1.15rem auto 0;
}

/* Completed State */
.route-completed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--success) 0%, #3a6249 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500;
}

.route-completed.active {
    display: flex;
}

.completed-content {
    text-align: center;
    color: white;
    padding: 2rem;
    max-width: 500px;
}

.completed-content h2 {
    font-family: 'Crimson Pro', serif;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.completed-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

/* Responsive */
@media (max-width: 640px) {
    .poem-card {
        margin: 1rem;
        padding: 1rem;
    }

    .poem-card-inner {
        padding: 2rem 1.5rem;
    }

    .poem-content {
        font-size: 1rem;
        padding: 1.5rem;
    }

    .recenter-btn {
        left: 16px;
        bottom: 16px;
    }
}
