/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    background-image: radial-gradient(circle, #e0e0e0 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Plus Data Brand Colors (to be updated later) */
:root {
    --plus-purple: #514D9B;
    --plus-purple-light: #8E24AA;
    --plus-green: #AFCC46;
    --plus-orange: #FB5C06;
    --plus-blue: #42A5F5;
    --plus-dark: #333;
    --plus-light: #f8f9fa;
    --plus-white: #ffffff;
}

/* Main content */
main {
    min-height: calc(100vh - 140px);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: var(--plus-purple-light);
    transform: translateY(-2px);
}

/* Footer */
footer {
    background-color: var(--plus-purple);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--plus-white);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo {
    width: 40px;
    height: 40px;
}

.logo-container h1 {
    color: var(--plus-purple);
    font-size: 1.8rem;
    font-weight: bold;
}

.login-header h2 {
    color: var(--plus-dark);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--plus-dark);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--plus-purple);
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.login-footer {
    text-align: center;
}

.login-footer .link {
    color: var(--plus-purple);
    text-decoration: none;
}

.login-footer .link:hover {
    text-decoration: underline;
}

/* Recording Page Styles */
.recording-container {
    min-height: 100vh;
    background: var(--plus-light);
}

.recording-header {
    background: var(--plus-purple);
    color: var(--plus-white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.welcome-message {
    font-size: 0.9rem;
    opacity: 0.8;
}

.logout-btn {
    background: var(--plus-green);
    color: var(--plus-white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: #7cb342;
}

.admin-btn {
    background: var(--plus-green);
    color: var(--plus-white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin-right: 1rem;
}

.admin-btn:hover {
    background: #7cb342;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.welcome-text {
    margin-bottom: 3rem;
}

.welcome-text h1 {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--plus-dark);
    margin: 0;
}

.recording-section {
    background: var(--plus-white);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.sound-wave {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 4px;
    height: 60px;
    margin-bottom: 1.5rem;
}

.wave-bar {
    width: 6px;
    background: var(--plus-green);
    border-radius: 3px;
    animation: wave 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 50px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 40px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 30px; animation-delay: 0.4s; }
.wave-bar:nth-child(6) { height: 25px; animation-delay: 0.5s; }
.wave-bar:nth-child(7) { height: 15px; animation-delay: 0.6s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.timer-display {
    font-size: 3rem;
    font-weight: bold;
    color: var(--plus-dark);
    margin-bottom: 1.5rem;
}

.record-btn {
    background: var(--plus-purple);
    color: var(--plus-white);
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.record-btn:hover {
    background: var(--plus-purple-light);
    transform: translateY(-2px);
}

.record-btn.recording {
    background: #e74c3c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.instruction-text {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.results-card {
    background: var(--plus-white);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.results-title {
    color: var(--plus-dark);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: bold;
}

.result-sections {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    background: #fafafa;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-header h3 {
    color: var(--plus-dark);
    font-size: 1.1rem;
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: var(--plus-purple);
    color: var(--plus-white);
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.action-btn:hover {
    background: var(--plus-purple-light);
}

.result-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    background: var(--plus-white);
    overflow-y: auto;
    box-sizing: border-box;
}

.result-textarea::placeholder {
    font-style: italic;
    color: #999;
}

.result-textarea-content {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    background: var(--plus-white);
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
}

.result-textarea-content:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
}

.result-textarea-content:focus {
    border-color: var(--plus-purple);
}

.result-textarea-content strong {
    font-weight: 600;
    color: var(--plus-dark);
}

.result-actions-bottom {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-green {
    background: var(--plus-green);
    color: var(--plus-white);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn-green:hover {
    background: #7cb342;
}


.btn-icon {
    margin-right: 8px;
}

/* Template Selector Styles */
.template-selector-container {
    margin-bottom: 2rem;
    text-align: center;
    max-width: 800px; /* Match main-content width */
    margin-left: auto;
    margin-right: auto;
}

.selector-title {
    margin-bottom: 1rem;
    color: var(--plus-dark);
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
}

.template-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.template-pill {
    background: transparent;
    border: 2px solid #e0e0e0;
    color: var(--plus-dark);
    padding: 10px 20px;
    border-radius: 50px; /* Makes them pill-shaped */
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(255, 255, 255, 0.5); /* Slight white tint */
}

.template-pill:hover {
    border-color: var(--plus-purple);
    transform: translateY(-2px);
    background-color: white;
    box-shadow: 0 4px 8px rgba(81, 77, 155, 0.15);
}

.template-pill.active {
    background: var(--plus-purple);
    border-color: var(--plus-purple);
    color: white;
    box-shadow: 0 4px 12px rgba(81, 77, 155, 0.3);
    transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 768px) {
    .recording-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-right {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-btn {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .welcome-text h1 {
        font-size: 2rem;
    }
    
    .recording-section {
        padding: 2rem;
    }
    
    .results-card {
        padding: 1.5rem;
    }
    
    .result-actions-bottom {
        flex-direction: column;
    }
    
    .login-card {
        padding: 2rem;
        margin: 1rem;
    }
}

/* Alert messages */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-weight: 500;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Relay Processing Animation */
.processing-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    margin: 1rem 0;
    border: 2px solid var(--plus-purple);
    box-shadow: 0 4px 15px rgba(81, 77, 155, 0.1);
}

.relay-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 1rem;
    position: relative;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--plus-purple);
    position: relative;
    animation: relay-pass 2s ease-in-out infinite;
}

.dot-1 {
    animation-delay: 0s;
}

.dot-2 {
    animation-delay: 0.7s;
}

.dot-3 {
    animation-delay: 1.4s;
}

.processing-text {
    color: var(--plus-purple);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    animation: text-pulse 2s ease-in-out infinite;
}

@keyframes relay-pass {
    0% {
        transform: scale(1);
        background: var(--plus-purple);
        box-shadow: 0 0 0 0 rgba(81, 77, 155, 0.4);
    }
    25% {
        transform: scale(1.3);
        background: var(--plus-green);
        box-shadow: 0 0 0 8px rgba(175, 204, 70, 0.2);
    }
    50% {
        transform: scale(1);
        background: var(--plus-purple);
        box-shadow: 0 0 0 0 rgba(81, 77, 155, 0.4);
    }
    100% {
        transform: scale(1);
        background: var(--plus-purple);
        box-shadow: 0 0 0 0 rgba(81, 77, 155, 0.4);
    }
}

@keyframes text-pulse {
    0%, 100% { 
        opacity: 0.8;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.05);
    }
}

input::placeholder,
textarea::placeholder {
    color: #555;
    font-style: italic;
}

input::-webkit-input-placeholder { /* Chrome, Safari, Edge */
    color: #555;
    font-style: italic;
}

/* Microphone Settings Panel */
.mic-settings-toggle {
    margin-top: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.btn-link-clean {
    background: none;
    border: none;
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px;
    text-decoration: underline;
    text-decoration-color: transparent; /* Hidden underline until hover */
    transition: all 0.2s;
}
.btn-link-clean:hover {
    color: var(--plus-purple);
    text-decoration-color: var(--plus-purple);
}

.mic-settings-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem auto 2rem;
    border: 1px solid #e0e0e0;
    text-align: left;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mic-settings-panel h4 {
    margin-bottom: 1rem;
    color: var(--plus-dark);
    font-size: 1.1rem;
}

.form-group label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    display: block;
}

.mic-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    background-color: #fff;
}

.mic-test-area {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.mic-meter-container {
    width: 100%;
    height: 12px;
    background-color: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.mic-meter-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--plus-green) 0%, var(--plus-purple) 100%);
    transition: width 0.05s ease-out;
    border-radius: 6px;
}

.mic-status-text {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
    text-align: right;
}
