/* Components CSS - Форми, кнопки, модальні вікна та інші компоненти */

/* Compiler секція */
.compiler-config {
    padding: 16px;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    color: #cccccc;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 6px 8px;
    background: #3c3c3c;
    border: 1px solid #464647;
    border-radius: 4px;
    color: #cccccc;
    font-size: 12px;
}

.form-control:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 1px #007acc;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkbox-group input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

.checkbox-group label {
    margin: 0;
    font-size: 12px;
    cursor: pointer;
}

/* Кнопки */
.remix-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.remix-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.remix-btn-primary {
    background: #007acc;
    color: white;
}

.remix-btn-primary:hover:not(:disabled) {
    background: #005a9e;
}

.remix-btn-orange {
    background: #f6851b;
    color: white;
}

.remix-btn-orange:hover:not(:disabled) {
    background: #e2761b;
}

.remix-btn-secondary {
    background: #5a5a5a;
    color: white;
    margin-top: 8px;
}

.remix-btn-secondary:hover:not(:disabled) {
    background: #6a6a6a;
}

.compile-button {
    margin-top: 8px;
}

/* Deploy секція */
.deploy-config {
    padding: 16px;
    overflow-y: auto;
}

.constructor-params {
    margin-bottom: 16px;
}

.param-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-input {
    padding: 6px 8px;
    background: #3c3c3c;
    border: 1px solid #464647;
    border-radius: 4px;
    color: #cccccc;
    font-size: 12px;
}

.account-balance {
    font-size: 11px;
    color: #888888;
    margin-top: 4px;
}

/* Deployed Contracts */
.deployed-contracts {
    margin-top: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.deployed-contracts h4 {
    font-size: 13px;
    color: #ffffff;
    margin-bottom: 12px;
}

.contract-address-input {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.contract-address-input input {
    flex: 1;
}

.contract-address-input button {
    width: auto;
    min-width: 80px;
}

.contracts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
}

.deployed-contract {
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #383838;
    cursor: pointer;
    min-height: 40px;
}

.contract-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 12px;
    word-break: break-word;
}

.contract-address {
    font-size: 9px;
    color: #888888;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    margin-top: 2px;
}

/* Функції контракту */
.contract-functions {
    padding: 8px;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    background: #252526;
}

.contract-functions.expanded {
    display: block;
}

.function-item {
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    margin-bottom: 6px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.function-item:hover {
    border-color: #007acc;
}

.function-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: #2d2d30;
    min-height: 32px;
}

.function-header:hover {
    background: #383838;
}

.function-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 11px;
    flex: 1;
    word-break: break-word;
    margin-right: 8px;
}

.function-type {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.function-type.view {
    background: #007acc;
    color: white;
}

.function-type.write {
    background: #f6851b;
    color: white;
}

/* Function inputs */
.function-inputs {
    padding: 6px 8px;
    background: #1a1a1a;
}

.function-inputs input {
    width: 100%;
    margin-bottom: 4px;
    padding: 4px 6px;
    background: #3c3c3c;
    border: 1px solid #464647;
    border-radius: 3px;
    color: #cccccc;
    font-size: 10px;
    box-sizing: border-box;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.function-inputs input:last-child {
    margin-bottom: 0;
}

.function-inputs input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 1px #007acc;
}

/* Function button */
.function-button {
    margin: 6px 8px 8px;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    width: calc(100% - 16px);
    box-sizing: border-box;
    min-height: 28px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.function-result {
    padding: 6px 8px;
    background: #1a1a1a;
    border-top: 1px solid #3e3e42;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 10px;
    max-height: 80px;
    overflow-y: auto;
    word-break: break-all;
    line-height: 1.3;
    animation: fadeIn 0.2s ease-in;
}

.function-result a {
    color: #007acc;
    text-decoration: none;
    word-break: break-all;
}

.function-result a:hover {
    text-decoration: underline;
}

/* Результати компіляції */
.compilation-output {
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    padding: 12px;
    margin-top: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    max-height: 200px;
    overflow-y: auto;
}

.output-placeholder {
    color: #888888;
    text-align: center;
    padding: 16px;
}

.compilation-success {
    color: #4caf50;
}

.compilation-error {
    color: #f44336;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: #2d2d30;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    border: 1px solid #3e3e42;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-header h2 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-body p {
    color: #cccccc;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .remix-btn {
    width: auto;
    min-width: 100px;
}

/* Responsive для вузьких sidebar */
@media (max-width: 1200px) {
    .function-name {
        font-size: 10px;
    }
    
    .function-type {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    .function-button {
        font-size: 9px;
        padding: 4px 6px;
        min-height: 24px;
    }
    
    .function-inputs input {
        font-size: 9px;
        padding: 3px 4px;
    }
}

/* Scrollbar для contract functions */
.contract-functions::-webkit-scrollbar {
    width: 6px;
}

.contract-functions::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.contract-functions::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 3px;
}

.contract-functions::-webkit-scrollbar-thumb:hover {
    background: #4f4f4f;
}