/**
 * Linux BenchTools - Peripherals Module CSS
 * Theme: Monokai Dark
 */

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.stat-card {
    background: #2d2d2d;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 217, 239, 0.2);
    border-color: #66d9ef;
}

.stat-icon {
    font-size: 2.5rem;
    color: #66d9ef;
    width: 60px;
    text-align: center;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #a6e22e;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #75715e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toolbar */
.toolbar {
    background: #2d2d2d;
    border: 1px solid #3e3d32;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    color: #75715e;
}

.search-box input {
    padding-left: 2.5rem;
    width: 250px;
}

/* Table */
.table-container {
    background: #2d2d2d;
    border: 1px solid #3e3d32;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #232323;
    border-bottom: 2px solid #3e3d32;
}

thead th {
    padding: 1rem;
    text-align: left;
    color: #f8f8f2;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

thead th:hover {
    background: #2d2d2d;
}

thead th i {
    margin-left: 0.5rem;
    color: #75715e;
    font-size: 0.8rem;
}

tbody tr {
    border-bottom: 1px solid #3e3d32;
    transition: background 0.2s ease;
    cursor: pointer;
}

tbody tr:hover {
    background: #232323;
}

tbody td {
    padding: 1rem;
    color: #f8f8f2;
}

tbody td.loading,
tbody td.no-data {
    text-align: center;
    padding: 3rem;
    color: #75715e;
}

.peripheral-photo {
    width: 50px;
    height: 50px;
    background: #232323;
    border: 1px solid #3e3d32;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #66d9ef;
    font-size: 1.5rem;
    overflow: hidden;
}

.peripheral-photo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

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

.btn-icon {
    background: transparent;
    border: none;
    color: #66d9ef;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #3e3d32;
    color: #a6e22e;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
}

.badge-success {
    background: rgba(166, 226, 46, 0.2);
    color: #a6e22e;
    border: 1px solid #a6e22e;
}

.badge-info {
    background: rgba(102, 217, 239, 0.2);
    color: #66d9ef;
    border: 1px solid #66d9ef;
}

.badge-warning {
    background: rgba(230, 219, 116, 0.2);
    color: #e6db74;
    border: 1px solid #e6db74;
}

.badge-danger {
    background: rgba(249, 38, 114, 0.2);
    color: #f92672;
    border: 1px solid #f92672;
}

.badge-secondary {
    background: rgba(117, 113, 94, 0.2);
    color: #75715e;
    border: 1px solid #75715e;
}

/* Stars */
.text-warning {
    color: #e6db74;
}

.text-muted {
    color: #75715e;
}

.text-danger {
    color: #f92672;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: #2d2d2d;
    border: 1px solid #3e3d32;
    border-radius: 8px;
}

.pagination span {
    color: #f8f8f2;
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow-y: auto;
}

.modal-content {
    background: #2d2d2d;
    margin: 2rem auto;
    border: 1px solid #3e3d32;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-content.modal-large {
    max-width: 1400px;
    width: 95%;
}

.modal-header {
    padding: 1rem 1.25rem;
    background: #232323;
    border-bottom: 1px solid #3a3a3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #f8f8f2;
    font-size: 1.3rem;
}

.modal-header h2 i {
    color: #66d9ef;
    margin-right: 0.5rem;
}

.close {
    color: #75715e;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.close:hover {
    color: #f92672;
}

.modal-body {
    padding: 1.25rem;
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.9rem;
}

.form-section {
    background: #232323;
    border: 1px solid #3e3d32;
    border-radius: 6px;
    padding: 0.9rem;
}

.form-section.full-width {
    grid-column: 1 / -1;
}

.form-section h3 {
    color: #66d9ef;
    margin: 0 0 0.7rem 0;
    font-size: 1rem;
    border-bottom: 1px solid #3e3d32;
    padding-bottom: 0.4rem;
}

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

.form-group label {
    display: block;
    color: #f8f8f2;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: #1e1e1e;
    border: 1px solid #3e3d32;
    border-radius: 4px;
    color: #f8f8f2;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #66d9ef;
    box-shadow: 0 0 0 3px rgba(102, 217, 239, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.3;
}

.help-text {
    color: #75715e;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.help-text code {
    background: #1e1e1e;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    color: #a6e22e;
    font-family: 'Courier New', monospace;
}

.file-preview {
    margin-top: 1rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #1e1e1e;
    border: 1px solid #3e3d32;
    border-radius: 6px;
}

.file-info i {
    font-size: 1.5rem;
    color: #66d9ef;
}

.file-info span {
    color: #f8f8f2;
}

.file-info .file-size {
    color: #75715e;
    font-size: 0.875rem;
    margin-left: auto;
}

.image-preview {
    border: 1px solid #3e3d32;
    border-radius: 6px;
    background: #1e1e1e;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.info-item {
    position: relative;
    padding-right: 2rem;
}

.copy-field-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: transparent;
    border: none;
    color: #e6db74;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.copy-field-btn:hover {
    color: #a6e22e;
}

.copy-field-btn.copied {
    color: #a6e22e;
}

.copy-field-btn .tooltip-copied {
    position: absolute;
    top: -28px;
    right: 0;
    background: #a6e22e;
    color: #272822;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 1000;
}

.copy-field-btn .tooltip-copied::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #a6e22e;
}

.copy-field-btn.copied .tooltip-copied {
    opacity: 1;
}

.form-actions {
    grid-column: 1 / -1;  /* Take full width of grid */
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #3e3d32;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #66d9ef;
    color: #272822;
}

.btn-primary:hover:not(:disabled) {
    background: #52c9e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 217, 239, 0.4);
}

.btn-secondary {
    background: #3e3d32;
    color: #f8f8f2;
}

.btn-secondary:hover:not(:disabled) {
    background: #49483e;
}

.btn-danger {
    background: #f92672;
    color: #f8f8f2;
}

.btn-danger:hover:not(:disabled) {
    background: #e91e63;
}

/* Responsive */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        flex-direction: column;
    }

    .search-box input {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.85rem;
    }

    tbody td,
    thead th {
        padding: 0.75rem 0.5rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content {
    animation: fadeIn 0.3s ease;
}

tbody tr {
    animation: fadeIn 0.2s ease;
}

/* USB Device List (with radio buttons) */
.usb-devices-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #3e3d32;
    border-radius: 4px;
    background: #1e1e1e;
}

.usb-device-item {
    padding: 1rem;
    border-bottom: 1px solid #3e3d32;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.2s ease;
    cursor: pointer;
}

.usb-device-item:last-child {
    border-bottom: none;
}

.usb-device-item:hover {
    background: #2d2d2d;
}

.usb-device-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.usb-device-info {
    flex: 1;
}

.usb-device-bus {
    font-family: 'Courier New', monospace;
    color: #66d9ef;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.usb-device-description {
    color: #a6e22e;
    font-size: 0.9rem;
}

.usb-device-id {
    color: #f92672;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* USB Import Instructions */
.import-instructions {
    background: #1e1e1e;
    border: 1px solid #3e3d32;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.import-instructions h3 {
    color: #66d9ef;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.command-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #272822;
    border: 1px solid #3e3d32;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.command-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #a6e22e;
    background: transparent;
    border: none;
    padding: 0;
}

.btn-copy {
    position: relative;
    background: #66d9ef;
    color: #272822;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-copy:hover {
    background: #a6e22e;
}

.btn-copy i {
    font-size: 1rem;
}

.devices-header {
    margin-bottom: 1.5rem;
}

.devices-header h3 {
    color: #66d9ef;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* USB Details Grid */
.usb-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.usb-details-grid .form-group input[readonly] {
    background-color: #1e1e1e;
    color: #a9b7c6;
    border: 1px solid #3a3a3a;
    cursor: default;
}

.usb-details-grid .form-group input[readonly]:focus {
    outline: none;
    border-color: #3a3a3a;
}

/* Help text inline in labels */
.help-text-inline {
    font-size: 0.85rem;
    color: #75715e;
    font-weight: normal;
    font-style: italic;
    margin-left: 0.5rem;
}

/* Star rating system */
.star-rating {
    display: flex;
    gap: 0.25rem;
    font-size: 1.5rem;
    cursor: pointer;
}

.star-rating i {
    color: #3a3a3a;
    transition: color 0.2s ease;
    cursor: pointer;
}

.star-rating i:hover,
.star-rating i.active {
    color: #f1c40f;
}

.star-rating i.active {
    text-shadow: 0 0 3px rgba(241, 196, 15, 0.5);
}

/* Copy button tooltip */
.btn-copy .tooltip-copied {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #66d9ef;
    color: #272822;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.btn-copy .tooltip-copied::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #66d9ef;
}

.btn-copy .tooltip-copied.show {
    opacity: 1;
}

/* Photo Primary Toggle */
.photo-primary-toggle {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #666;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #999;
    font-size: 16px;
    z-index: 10;
}

.photo-primary-toggle:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: #66d9ef;
    color: #66d9ef;
    transform: scale(1.1);
}

.photo-primary-toggle.active {
    background: rgba(102, 217, 239, 0.2);
    border-color: #66d9ef;
    color: #66d9ef;
}

.photo-primary-toggle.active:hover {
    background: rgba(102, 217, 239, 0.3);
}

.photo-item {
    position: relative;
}
