/**
 * Main Stylesheet
 * สไตล์หลักสำหรับระบบ Shareholder Chatbot
 */

:root {
    --primary-color: #00B900; /* LINE Green */
    --secondary-color: #333333;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --error-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans Thai', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 24px;
    font-weight: bold;
}

/* Card */
.card {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}

.login-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
}

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

.btn-primary:hover {
    background-color: #00A000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,185,0,0.3);
}

.btn-secondary {
    background-color: #f0f0f0;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

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

.btn-line {
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-line:hover {
    background-color: #00A000;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 10px;
}

/* Status Messages */
.status-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

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

.status-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.status-error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
}

.status-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

.status-info {
    background-color: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* Profile Section */
.profile-section {
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.profile-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.profile-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Dashboard Styles */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color), #00A000);
    color: white;
    padding: 30px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.dashboard-welcome {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.dashboard-title {
    font-size: 28px;
    font-weight: bold;
}

/* Search Container */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

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

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background-color: #f0f0f0;
    color: #666;
}

/* Meeting List */
.meeting-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
    border-radius: 8px;
}

.meeting-item {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.meeting-item:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 185, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.meeting-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 185, 0, 0.1);
}

.meeting-item.hidden {
    display: none;
}

.highlight {
    background-color: yellow;
    font-weight: bold;
    padding: 1px 2px;
    border-radius: 2px;
}

.meeting-info {
    flex: 1;
}

.meeting-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.meeting-date {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.meeting-badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
}

/* Scrollbar สำหรับ meeting list */
.meeting-list::-webkit-scrollbar {
    width: 6px;
}

.meeting-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.meeting-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.meeting-list::-webkit-scrollbar-thumb:hover {
    background: #00A000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .dashboard-title {
        font-size: 24px;
    }
    
    .meeting-title {
        font-size: 14px;
    }
    
    .meeting-date {
        font-size: 11px;
    }
    
    .meeting-item {
        padding: 10px 12px;
        margin-bottom: 6px;
    }
    
    .meeting-list {
        max-height: 300px;
    }
    
    .meeting-badge {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .search-clear {
        width: 20px;
        height: 20px;
        font-size: 16px;
        right: 10px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    margin: auto;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

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

.modal-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.modal-close {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin: 0 0 15px 0;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 185, 0, 0.1);
}

.form-input::placeholder {
    color: #999;
}

.modal-footer {
    padding: 10px 20px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Loading Modal Styles */
.loading-modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.loading-modal-content {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    width: 90%;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
}

.loading-subtext {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 10px 0 0 0;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.justify-center { justify-content: center; }
.align-center { align-items: center; }
.flex-column { flex-direction: column; }