/* styles/components.css - Reusable Components */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: var(--tracking-normal);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-danger:hover {
    opacity: 0.9;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-button:hover {
    background: var(--accent);
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

section#history .card-header {
    flex-direction: column !important;
    align-items: stretch;
}


.card-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    margin-bottom: 1rem;

}

.card-content {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--chart-positive);
}

.stat-change.negative {
    color: var(--chart-negative);
}

/* Win Rate Circle */
.win-rate-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.win-rate-circle svg {
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.circle-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out;
}

.win-rate-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.win-rate-text .percentage {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

/* Forms */
.form-section,
.form-card {
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background: var(--accent);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 600px;
}

.data-table th {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    font-size: 0.875rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid var(--chart-positive);
}

.toast-error {
    border-left: 4px solid var(--destructive);
}

.toast-warning {
    border-left: 4px solid var(--chart-4);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

/* Metric Cards */
.metric-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.metric-card i {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.metric-card.positive i {
    color: var(--chart-positive);
}

.metric-card.negative i {
    color: var(--chart-negative);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Chart Container - Mobile First */
.chart-container {
    position: relative;
    width: 100%;
    padding: 0.75rem;
    min-height: 250px;
    overflow: hidden;
}

.chart-card {
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Make canvas responsive */
.chart-container canvas {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
}

/* Mobile landscape optimization */
@media (orientation: landscape) and (max-width: 768px) {
    .chart-container {
        min-height: 200px;
    }
}

/* Tablet and larger */
@media (min-width: 768px) {
    .chart-container {
        padding: 1.5rem;
        min-height: 350px;
    }
    .card-header{
        flex-direction: row;
    }
    
    .card-header h2 {
        margin-bottom: 0;
    }

/* Desktop */
@media (min-width: 1024px) {
    .chart-container {
        min-height: 400px;
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Button Group */
.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--accent);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-header h3 i {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--background);
    color: var(--foreground);
}

.modal-close i {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
}

.modal-description {
    margin: 0 0 1.5rem 0;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.5;
}

.modal-body .form-group {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.modal-body input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--input);
    color: var(--foreground);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--accent);
}

.modal-footer .btn {
    min-width: 120px;
}

/* Modal Large Variant */
.modal-content.modal-large {
    max-width: 900px;
    width: 95%;
}

.modal-large .modal-body {
    max-height: calc(90vh - 140px);
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-large .form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-large .form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.modal-large .form-section h4 {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-large .signals-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-large textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--input);
    color: var(--foreground);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.2s ease;
}

.modal-large textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

/* Mobile responsive for modal */
@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

